I am trying to execute a small example of automated test using Webstorm, cucumber and protractor.
I have already installed cucumber using this command within the root of the project:
sudo npm install -g cucumber
I have already created the conf.js file and when running this command within the prompt:
> protractor conf.js
Finally, the output is:
*
[13:13:18] E/launcher - Error: Error: Cannot find module 'cucumber'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.module.exports.load (/Users/alfredo.bazo/node_modules/protractor-cucumber-framework/lib/cucumberLoader.js:19:24)
at Object.<anonymous> (/Users/alfredo.bazo/node_modules/protractor-cucumber-framework/index.js:8:33)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
[13:13:18] E/launcher - Process exited with error code 100
I have no idea what else I can do, any suggestions?
There are two approach to resolve your problem, and recommend to use approach 1).
1) install cucumber as project local package, rather than global package.
npm install -S cucumber
2) install cucumber as global package, and you need to add below Environment variable to tell node.exe where to find and load global package.
NODE_PATH=<npm global package install folder path on your machine>
you can execute npm config get prefix which will print out the global package install folder path.
Important: After add environment variable, you need to try in new opened cmd/terminal window.
how to overcome this :try to share video please regarding this query : ...
install cucumber as global package, and you need to add below Environment variable to tell node.exe where to find and load global package.
NODE_PATH=
you can execute npm config get prefix which will print out the global package install folder path.
Important: After add environment variable, you need to try in new opened cmd/terminal window.
Related
I am trying to build Visual Studio Code so the dependencies are compiled in (can't install rpm packages as I don't have root). I have worked through a few issues so far, but I can't figure out why I am getting the following error.
[mrhicks#xxxxxx repo]$ yarn run watch
yarn run v1.12.3
$ gulp watch --max_old_space_size=4095
[20:28:22] Node flags detected: --max_old_space_size=4095
[20:28:22] Respawned to PID: 27503
module.js:550
throw err;
^
Error: Cannot find module 'gulp-bom'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/users/mrhicks/projects/vscode/repo/build/lib/compilation.js:10:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have make sure to re-run sudo npm install to try and ensure everything for npm is installed. I have been following the instructions from the VSCode site here
I had this locally. It went away after yarn add gulp-bom --no-save. 🤷♂️
If you applied the changes at https://github.com/addaleax/natives/commit/0abbec6b0e211c6bbe3bf0d2b33fcd68f5a6c980, you'll need to re-apply them after.
I am trying to bundle the completely installed version of vsliveshare. To do that, I have to run the extension activation once because that downloads & installs additional files into the extension folder.
Now my instinct was to just run
% echo "require('./out/src/extension').activate()" | node
but that does not work out:
module.js:549
throw err;
^
Error: Cannot find module 'vscode'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
...
I've done a npm install and the vscode module is present in node_modules.
Is there any trick I can use to get this to execute from the command line without having to run vscode itself?
I'm a beginner for Ionic and getting mentioned error when i'm run the bellow code,
ionic start IonicShoppingList blank
Error: Cannot find module 'lodash._basecopy'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Denuka\AppData\Roaming\npm\node_modules\ionic\node_modules\lodash._baseassign\index.js:9:16)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
I have installed node.js npm and ionic cordova.
What should i do to solve this ?
Be sure to install lodash in the required folder.
If that folder has a package.json file, it is also best to add --save behind the install command.
$ npm install lodash --save
if the package.json file exists, and if it contains the lodash dependency you could try to remove the node_modules folder and run following command:
$ npm cache clean
$ npm install
The first command will clean the npm cache. (just to be sure) The second command will install all (missing) dependencies of the project.
I hope it helps.
I am trying to get a build going for Aurelia on VSO Hosted Build Controller. I created a small powershell script to run the following commands
npm install
.node_modules/.bin/jspm cc
.node_modules/.bin/jspm install -y
.node_modules/.bin/gulp build
I do have AfterBuild targets to copy the jspm_packages and dist folders to my _publishedWebsites folder.
npm install runs fine, but when it comes to jspm cc (if I remove the jspm cc and let it run jspm install -y), it fails trying to this
jspm cc
Migrating global jspm folder from C:\Users\buildguest\.jspm to C:\Users\buildguest\AppData\Local\.jspm...
Copying configuration...
err Error migrating to new jspm folder
2>EXEC : error : ENOENT, no such file or directory 'C:\Users\buildguest\.jspm\config' [d:\a\src\WebGUI\OwinAureliaScaffold\OwinAureliaScaffold.csproj]
at Object.fs.openSync (evalmachine.<anonymous>:427:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:284:15)
at Object.<anonymous> (d:\a\src\WebGUI\OwinAureliaScaffold\public\node_modules\jspm\lib\global-config.js:36:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (d:\a\src\WebGUI\OwinAureliaScaffold\public\node_modules\jspm\lib\registry.js:19:20)
ok Loader file cache cleared.
ok Package cache cleared.
I do understand the jspm is not installed globally, since it is a hosted controller, I cannot really install it globally. My question is, how do I work through this without having a global jspm install? Is there a workaround where it does not have to migrate the config file?
Even though you cannot install and run the jspm CLI on the hosted build agent, you can run jspm through node itself.
First, make sure jspm is installed - which your powershell script does. Alternatively, you can use VSO Build's "npm install task", provided jspm is in your package.json file.
I used Gulp to execute jspm through node. I'm not sure if that's the best way to do this step, but it works... I used VSO's "Gulp task"
Here are the relevant bits from gulpfile.js:
var gulp = require('gulp'),
exec = require('child_process').exec;
//#region Build Tasks
gulp.task('build:jspm', function (cb) {
exec("node ./node_modules/jspm/jspm.js install", function(err, stdout, stderr) {
console.log(stdout);
console.error(stderr);
cb(err);
});
});
gulp.task('_build', ['build:jspm']);
I do understand the jspm is not installed globally, since it is a hosted controller, I cannot really install it globally.
It appears that this is not true (at least currently.) You can install jspm globally on a hosted controller.
I was able to solve this with a build process that looks like this:
npm install
npm install -g jspm
node C:\NPM\Modules\node_modules\jspm\jspm.js install
1) Installs all of the local dependencies from my package.json. 2) Installs a global version of JSPM 3) Evokes it from the global installation location
I realized from M Falanga's answer that node was obviously in the controller's path so I could call it from Powershell/command line. The global JSPM install location I found from looking at the build's debug logs. Note to implementors, you'll want to make sure your working directory for steps 1 and 3 are set to where your package.json is located.
Alternative Solution
I have not tested this next option in a build yet but you should be able to skip the extra build steps and just use the scripts feature of NPM to do the JSPM install. In this case you won't need the NPM install step nor the Run node step above.
In your package.json you'll need the following script entry:
"keywords": [...],
"scripts": {
"postinstall": "./node_modules/.bin/jspm install -y"
},
"jspm": {...
If administrative privileges are required on the computer to install a package, there's no way for you to do it in hosted build. You will have to create your own build machine in this case. It's something we hope to solve in the future.
That said, here's what one person did to get Aurelia set up: http://fabhojs.blogspot.com/2015/03/aurelia-app-skeleton-yeoman-generator.html (from this question). Those steps are different and may help.
I just installed protractor and the default repo along with webdriver. Every time I run protractor I get this error
module.js:340
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/protractor/lib/cli.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Not sure how to fix this... any clues?
Try to use the following solution :
under Configuration , use this for javascript file = /usr/lib/node_modules/protractor/lib/cli.js
I faced similar issue , it got resolved . I am using WebStorm in linux environment .
Make sure you installed protractor on the global position , by using this command :
sudo npm install -g protractor
sudo webdriver-manager update
webdriver-manager start
Got stuck similarly ... this worked for me.
Make sure to have "node_modules" & "node_modules/.bin" in the project folder, you can generate them by
running "npm install protractor" on the project root folder and then get rid of it "protractor" folder by running "npm uninstall protractor".