I did an npm install and it generated a node_modules folder on my folder with only a gulp-livereload subfolder in it. My package.json has the following devDependencies:
.....
"devDependencies": {
"gulp": "^3.8.8",
"gulp-livereload": "^2.1.1"
}
}
When doing npm install/update, it is not generating the gulp folder and also giving me the error message:
> v8flags#1.0.1 install C:\Users\SLowe\node_modules\gulp\node_modules\v8flags
> node fetch.js
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\SYoung\fetch.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:906:3
npm ERR! v8flags#1.0.1 install: `node fetch.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the v8flags#1.0.1 install script.
npm ERR! This is most likely a problem with the v8flags package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node fetch.js
npm ERR! You can get their info via:
npm ERR! npm owner ls v8flags
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
"install" "--save-dev" "gulp"
npm ERR! cwd C:\Users\SYoung
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
Any help is appreciated. I am very new to nodejs.
It seems that the new gulp release (3.8.9) isn't compatible with v8flags. Try changing the package.json to
.....
"devDependencies": {
"gulp": "3.8.8",
"gulp-livereload": "^2.1.1"
}
}
If 3.8.8 doesn't work, 3.8.7 worked for me.
Yes, changing gulp to 3.8.8 helped me too.
I also installed gulp 3.8.8 and everything is now working fine.
npm install -g gulp#3.8.8
npm install gulp#3.8.8
Related
My CI tool uses node version 4.8.3. So I had to roll back my local node.js from 6 to 4.8.3. Now when I do npm install -g I see the following error.
I wasnt facing the error when I was using 6x version but with 4.8.3 I am. Please advice?
C:\Users\jasharma\gitrepo\Protractor Framework\customer-portal>npm install -g
npm WARN deprecated nodemailer#0.7.1: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN engine selenium-webdriver#3.4.0: wanted: {"node":">= 6.9.0"} (current: {"node":"4.8.3","npm":"2.15.11"})
npm WARN peerDependencies The peer dependency karma#>=0.9 included from karma-junit-reporter will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated mimelib#0.2.19: This module is deprecated
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN engine webdriver-manager#10.3.0: wanted: {"node":">=4","npm":">=3"} (current: {"node":"4.8.3","npm":"2.15.11"})
> chromedriver#2.30.1 install C:\Users\jasharma\AppData\Roaming\npm\node_modules\npmpackages\node_modules\chromedriver
> node install.js
module.js:327
throw err;
^
Error: Cannot find module '../dotjs/validate'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\jasharma\AppData\Roaming\npm\node_modules\npmpackages\node_modules\request\node_modules\har-validator\node_modules\ajv\lib\compile\index.js:18:25)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN optional dep failed, continuing fsevents#1.1.2
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g"
npm ERR! node v4.8.3
npm ERR! npm v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! chromedriver#2.30.1 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chromedriver#2.30.1 install script 'node install.js'.
npm ERR! This is most likely a problem with the chromedriver package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs chromedriver
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls chromedriver
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\jasharma\gitrepo\Protractor Framework\customer-portal\npm-debug.log
C:\Users\jasharma\gitrepo\Protractor Framework\customer-portal>
Either:
Update the CI tool so it can run on a modern version of NodeJS
Use a tool like nvm to install multiple versions of NodeJS at the same time
I try to install Spectron, by using this command:
npm install --save-dev spectron
but I get this Err msg:
npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program
Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "install" "--save-dev" "spectron"
npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ENOSELF
npm ERR! Refusing to install spectron as a dependency of itself npm
ERR! npm ERR! If you need help, you may report this error at: npm ERR!
https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\spectron-master\npm-debug.log
What i'm doing wrong?
If you don't set any name in the package.json by default the folder name is taken.
You can't install a Package which is same like the name in package.json.
example : trying to install Spectron in a project having the name Spectron in package.json is supposed to raise this error.
I'm having an issue trying to clean up some code.
Here is the portion of code where I am trying to import certain files from the pageObject directory, these LOC are in all my test files:
var config = require('../../../../adminVariables');
var AdminLogin = require('../../../../pageObject/admin/login/index');
var HeaderProfile = require('../../../../pageObject/admin/login/common/headerProfile/index');
var AccountSettings = require('../../../../pageObject/admin/login/accountSettings/index');
adminVariables and index are both javascript files.
It looks very ugly and I want to minimize it to make it more readable and elegant by reducing all the ../../../ (also my boss doesn't like it).
I've tried following the NPM docs found here: https://docs.npmjs.com/files/package.json#local-paths
but I'm slightly confused about using npm install --save. My page object directories do not have package.json files in them. Just simple js files that create classes and methods that I reference in my tests scripts. I get this error:
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
I thought maybe I can do it manually such as altering my package.json as:
{
"dependencies": {
"admin-variables": "file:./qe/adminVariables",
"admin-login": "file:./qe/pageObject/admin/login/index",
"header-profile": "file:./qe/pageObject/admin/login/common/headerProfile/index",
"account-settings": "file:./qe/pageObject/admin/login/accountSettings/index"
}
}
Then change the previous LOC to this:
var config = require('admin-variables');
var AdminLogin = require('admin-login');
var HeaderProfile = require('header-profile');
var AccountSettings = require('account-settings');
But when I try to run my test scripts I get the following error:
module.js:340
throw err;
^
Error: Cannot find module 'admin-variables'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/username/go/src/bitbucket.org/companyname/platform/qe/test/admin/dashboard/adminUser/pdvi-2361.js:7:14)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at /Users/username/go/src/bitbucket.org/companyname/platform/qe/node_modules/mocha/lib/mocha.js:216:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/username/go/src/bitbucket.org/companyname/platform/qe/node_modules/mocha/lib/mocha.js:213:14)
at Mocha.run (/Users/username/go/src/bitbucket.org/companyname/platform/qe/node_modules/mocha/lib/mocha.js:453:10)
at Object.<anonymous> (/Users/username/go/src/bitbucket.org/companyname/platform/qe/node_modules/mocha/bin/_mocha:393:18)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:138:18)
at node.js:974:3
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.1.1/bin/node" "/usr/local/bin/npm" "run" "env-production" "mocha" "test/admin/dashboard/adminUser/pdvi-2361.js" "--" "--reporter" "spec" "--slow" "0"
npm ERR! node v5.1.1
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! ui-tests#1.0.0 env-production: `env envVar='production' "mocha" "test/admin/dashboard/adminUser/pdvi-2361.js" "--reporter" "spec" "--slow" "0"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ui-tests#1.0.0 env-production script 'env envVar='production' "mocha" "test/admin/dashboard/adminUser/pdvi-2361.js" "--reporter" "spec" "--slow" "0"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ui-tests package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! env envVar='production' "mocha" "test/admin/dashboard/adminUser/pdvi-2361.js" "--reporter" "spec" "--slow" "0"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ui-tests
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ui-tests
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/username/go/src/bitbucket.org/companyname/platform/qe/npm-debug.log
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.1.1/bin/node" "/usr/local/bin/npm" "run" "p-2361:spec"
npm ERR! node v5.1.1
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! ui-tests#1.0.0 p-2361:spec: `npm run env-production mocha test/admin/dashboard/adminUser/pdvi-2361.js -- --reporter spec --slow 0`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ui-tests#1.0.0 p-2361:spec script 'npm run env-production mocha test/admin/dashboard/adminUser/pdvi-2361.js -- --reporter spec --slow 0'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ui-tests package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run env-production mocha test/admin/dashboard/adminUser/pdvi-2361.js -- --reporter spec --slow 0
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ui-tests
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ui-tests
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/username/go/src/bitbucket.org/companyname/platform/qe/npm-debug.log
Here is my directory structure that I work in (mostly qe/ folder).
platform/
qe/
node_modules/
pageObject/
admin/
login/
accountSettings/
index.js
common/
headerProfile/
index.js
dashboard/
index.js
index.js
test/
admin/
dashboard/
adminUser/
pdvi-2361.js
pdvi-2372.js
pdvi-2377.js
adminVariables.json
package.json
Here is an example of what my page object looks like:
var webdriver = require('selenium-webdriver');
var config = require('../../../adminVariables');
var adminVar = process.env.envVar;
var login = config[adminVar].adminLogin;
var user = config[adminVar].role.adminUser.name;
var email = config[adminVar].role.adminUser.email;
var pw = config[adminVar].role.adminUser.password;
class AdminLogin {
constructor(driver) {
this.driver = driver;
this.driver.manage().timeouts().implicitlyWait(2000);
this.emailField = this.driver.findElement({
css: 'input[name="email"]'
});
this.passwordField = this.driver.findElement({
css: 'input[name="password"]'
});
this.loginButton = this.driver.findElement({
css: 'button[type="submit"]'
});
}
fillEmail(email) {
this.emailField.sendKeys(email);
}
fillPassword(password) {
this.passwordField.sendKeys(password);
}
signin() {
this.loginButton.click();
}
}
module.exports = AdminLogin;
What would be the proper way to require these local json/javascript files in my code?
I'm following this tutorial to install express JS. http://expressjs.com/2x/guide.html but I'm getting an error while installing the dependencies. Below is my error. Can somebody help me what I'm missing here?
C:\Users\myname\nodejs>npm install -d
npm info it worked if it ends with ok
npm info using npm#1.4.9
npm info using node#v0.10.28
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open 'C:\Users\myname\nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Users\\myname\\nodejs\\\\node.exe" "C:\\Users\\sainath.
g\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d"
npm ERR! cwd C:\Users\myname\nodejs
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path C:\Users\myname\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\myname\nodejs\npm-debug.log
npm ERR! not ok code 0
C:\Users\myname\nodejs>node app.js
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\myname\nodejs\app.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:906:3
You are a following a guide to express.js version 2.0 which is deprecated.
The latest express.js version is 4 and this is the guide you should actually follow :
express.js Getting Started Guide
I could install gruntjs locally using npm install grunt.
But when I'm trying to install it globally npm install grunt -g, i'm getting an error:
npm ERR! Error: EACCES, symlink '../lib/node_modules/grunt/bin/grunt'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Linux 2.6.18-92.el5xen
npm ERR! command "nodejs" "/usr/bin/npm" "install" "grunt" "-g"
npm ERR! cwd /home/lj
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.19
npm ERR! path ../lib/node_modules/grunt/bin/grunt
npm ERR! code EACCES
npm ERR! message EACCES, symlink '../lib/node_modules/grunt/bin/grunt'
npm ERR! errno {}
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Linux 2.6.18-92.el5xen
npm ERR! command "nodejs" "/usr/bin/npm" "install" "grunt" "-g"
npm ERR! cwd /home/lj
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.19
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! message EACCES, open 'npm-debug.log'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/lj/npm-debug.log
npm not ok
With sudo I have error too:
npm ERR! Error: spawn ENOENT
npm ERR! at errnoException (child_process.js:483:11)
npm ERR! at ChildProcess.spawn (child_process.js:446:11)
npm ERR! at child_process.js:342:9
npm ERR! at Object.execFile (child_process.js:252:15)
npm ERR! at uidNumber (/usr/lib/nodejs/uid-number/uid-number.js:33:17)
npm ERR! at loadUid (/usr/lib/nodejs/npm/lib/npm.js:336:5)
npm ERR! at Array.2 (/usr/lib/nodejs/bind-actor.js:15:8)
npm ERR! at LOOP (/usr/lib/nodejs/chain.js:15:13)
npm ERR! at /usr/lib/nodejs/chain.js:18:7
npm ERR! at setUser (/usr/lib/nodejs/npm/lib/npm.js:346:32)
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Linux 2.6.18-92.el5xen
npm ERR! command "nodejs" "/usr/bin/npm" "install" "grunt" "-g"
npm ERR! cwd /home/lj
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.19
npm ERR! syscall spawn
npm ERR! code ENOENT
npm ERR! message spawn ENOENT
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/lj/npm-debug.log
npm not ok
What could I do to install it?
P.S. It's possible that come rights for some folders is for root:root, not for my user. Cuz our admins installed VM that way...
I've had this problem too with grunt and bower
The solution I've found is in this article NPM config
In your .npmrc you need to set the prefix path
prefix = /usr/local
or you can do it from terminal like this:
npm config set prefix "/usr/local"
This way node will know where to install them:
In npm 1.0, there are two ways to install things:
globally —- This drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. It also installs man pages in {prefix}/share/man, if they’re supplied.
locally —- This installs your package in the current working directory. Node modules go in ./node_modules, executables go in ./node_modules/.bin/, and man pages aren’t installed at all.
Try chowning the node_modules folder and then try to install again:
sudo chown -R $USER /path/to/node_modules/folder
Encountered same issue. The following works for me:
sudo npm install -g grunt-cli
try sudo npm install -g grunt ?
Adding the option --no-bin-links works good. I tried everything and only this solved my problem. I was installing the Yeoman on ubuntu 12.04 and it was always returning the error:
npm ERR! Error: EACCES, symlink '../lib/node_modules/yo/cli.js'
Then, I did:
npm install -g --no-bin-links yo
=D
For more details https://github.com/isaacs/npm/issues/2380