Multiple npm install fails (EPERM error) - windows

Im trying to install multiple packages in different child processes. And all the packages have some common dependency(browserify in my case).
example
|
|_pkg1
| |_browserify
|
|_pkg2
| |_browserify
|
|_pkg3
| |_browserify
|
|_run.js
run.js:
var packages = ['pkg1', 'pkg2', 'pkg3'];
packages.forEach(function(pkg){
exec('npm install ./' + pkg);
});
And node run.js fails with log
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i
nstall" "./pkg3"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\Artem\\AppData\\Roaming\\npm-cache\\acorn\\0.9.0\\package\\package.json',
npm ERR! parent: 'syntax-error' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
Example: https://github.com/SakerONE/multiple-npm-install

Works fine with npm 2.9.1
Just try to upgrade your npm
npm install npm#latest -g

This seems to be a tricky bug in npm, most probably, a race condition of parallel tasks writing the same package.json.
You can use --force flag to avoid cache (but it might be slow to download all dependencies on each build). Or wait for npm team to implement a permanent fix.
Related links to watch on Github:
https://github.com/Microsoft/vso-agent-tasks/issues/323
https://github.com/npm/npm/issues/2500
https://github.com/npm/npm/issues/9696

Related

ExpressJS installing errors in OS X

I've been working on this for a while and it's the simplest thing....I NEED to simply install express so I can move on and actually work. No matter what I do I get this same error and Express won't install:
~ npm install -g express
npm WARN checkPermissions Missing write access to /Users/revjtanton/.nvm/versions/node/v0.12.2/lib/node_modules/express
/Users/revjtanton/.nvm/versions/node/v0.12.2/lib
└── express#4.14.0
npm ERR! Darwin 15.6.0
npm ERR! argv "node" "/Users/revjtanton/.nvm/versions/node/v0.12.2/bin/npm" "install" "-g" "express"
npm ERR! node v0.12.2
npm ERR! npm v3.9.3
npm ERR! path /Users/revjtanton/.nvm/versions/node/v0.12.2/lib/node_modules/express
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, access '/Users/revjtanton/.nvm/versions/node/v0.12.2/lib/node_modules/express'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, access '/Users/revjtanton/.nvm/versions/node/v0.12.2/lib/node_modules/express']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/revjtanton/.nvm/versions/node/v0.12.2/lib/node_modules/express' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/revjtanton/npm-debug.log
I've managed permissions, cleaned caches, tried installing with sudo (which doesn't produce an error...but I'm still not able to use express).
Execute the command with sudo:
sudo npm install -g express

Installing PhantomJS 2 using NPM fails on Windows

I'm trying to install PhantomJS 2 for a project that requires support for mutation observers. When I use the following command:
npm install phantomjs2 --save-dev
I get the following error:
Unexpected platform or architecture: win32 x64
npm ERR! phantomjs2#2.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs2#2.0.0 install script.
npm ERR! This is most likely a problem with the phantomjs2 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 their info via:
npm ERR! npm owner ls phantomjs2
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs2" "--save-dev"
npm ERR! cwd g:\Web\GitHub\pet
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! g:\Web\GitHub\pet\npm-debug.log
npm ERR! not ok code 0
I am using 64 bit Windows 7. Is PhantomJS 2 just not supported on my platform?
Yes, that package currently doesn't support installing PhantomJS 2 on Windows. Just download it from the official page and put the exe in a directory that is in the PATH.

npm install doesn't work with --save-dev option on windows 8

On my windows8 I tried to install a npm package
npm install grunt-contrib-uglify --save-dev
if I run it without --save-dev it works perfectly
npm install grunt-contrib-uglify --save-dev
adding saving couses an error:
npm ERR! Error: EPERM, open 'C:\2\package.json'
npm ERR! { [Error: EPERM, open 'C:\2\package.json'] errno: 50, code: 'EPERM', path: 'C:\\2\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
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" "grunt-contrib-uglify" "--save-dev"
npm ERR! cwd C:\2
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\2\package.json
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open 'C:\2\package.json'
npm ERR! Error: EPERM, open 'C:\2\npm-debug.log'
npm ERR! { [Error: EPERM, open 'C:\2\npm-debug.log'] errno: 50, code: 'EPERM', path: 'C:\\2\\npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
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" "grunt-contrib-uglify" "--save-dev"
npm ERR! cwd C:\2
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\2\npm-debug.log
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open 'C:\2\npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\2\npm-debug.log
npm ERR! not ok code 0
I've checked files permissions, I've ran it as Administrator. I cannot find a way to get it working.
Please, help ;)
I had the same issue on OSX, I fixed it executing:
sudo chown -R $USER:$GROUP ~/.npm
and:
npm cache clean
Then I can install the package with --save-dev in the project.
In your case, instead of using chown you can change the permissions on "C:\2" and subfolders to your user using the Windows Explorer, i.e: http://technet.microsoft.com/en-us/magazine/ff404240.aspx Or directly from PowerShell: http://blogs.msdn.com/b/johan/archive/2008/10/01/powershell-editing-permissions-on-a-file-or-folder.aspx
Source: https://github.com/npm/npm/issues/5869

Web starter kit installation Error

when i run the installation process and put npm install in the command line after running some processes it gives me this :
npm ERR! safefs#3.0.6 preinstall: `node ./cyclic.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the safefs#3.0.6 preinstall script.
npm ERR! This is most likely a problem with the safefs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./cyclic.js
npm ERR! You can get their info via:
npm ERR! npm owner ls safefs
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\Class Talkies\Desktop\www\web-starter-kit-master
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall spawn
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! not ok code 0
I also got a few errors upon installing via the npm install command, but in order to get it to go away I relaunched command prompt in administrator mode. It solved the problem easily.
Hope it helps!

Bower Installation Errors

Now I have installed Node and Npm and I run this command in terminal (yes I am on a mac):
npm install -g bower
Which follows with this output from the terminal:
npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Superfunnytogo
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Superfunnytogo/npm-debug.log
npm ERR! not ok code 0
Device-365-352:~ Superfunnytogo$ npm install -g bower
npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Superfunnytogo
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Superfunnytogo/npm-debug.log
npm ERR! not ok code 0
You need root access or permissions to install globally! Try :
sudo npm install -g bower
Much better than using sudo is setting a user level prefix. For example in ~/.npmrc set:
prefix = ${HOME}/npm-global
to use this folder for packages installed with -g.
Then you also need to set your PATH environment variable to include ${HOME}/npm-global/bin.
you shouldn't sudo bower right? I mean sudo npm install -g bower will work BUT here's the message I got:
Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814
You can however run a command with sudo using --allow-root option
If you've installed node/npm via Homebrew on OSX you may want to first run brew doctor and follow instructions before sudo-ing any system folders. In my case this brought up a nag about agreeing to an Xcode/iOS license:
Builds will fail! Agree to the license by opening Xcode.app or running:
xcodebuild -license
After doing that and running a brew update I was able to install Bower globally as expected.
I know that it's an old thread but I run into the issue recently after reinstalling Yosemite and xCode tools. In case anyone else gets stuck, what helped me was using the commands:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Following suggestion from the thread below:
https://github.com/bower/bower/issues/2262
Using sudo with npm is discouraged.
Look here https://stackoverflow.com/a/18277225/1857521 for a better solution to an almost identical problem.

Resources