Certain NPM installs fail with EPERM 50 (Gulp and others) - windows

I continue to get permissions errors on Windows 7 when trying to npm install certain modules. A global install of gulp for example results in this:
c:\Users\abc\Documents\uniform\UniServer\www\ur>npm install -g gulp
/
> v8flags#1.0.1 install C:\Users\abc\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags
> node fetch.js
flags for v8 3.14.5.9 cached.
npm ERR! Error: EPERM, open 'C:\Users\abc\Documents\uniform\UniServer\www\npmcache\c14291c8-che-
ansi-regex-0-2-1-package-tgz.lock'
npm ERR! { [Error: EPERM, open 'C:\Users\abc\Documents\uniform\UniServer\www\npmcache\c14291c8-
che-ansi-regex-0-2-1-package-tgz.lock']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\abc\\Documents\\uniform\\UniServer\\www\\npmcache\\c14291c8-che-ans
i-regex-0-2-1-package-tgz.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\n
pm\\bin\\npm-cli.js" "install" "-g" "gulp"
npm ERR! cwd c:\Users\abc\Documents\uniform\UniServer\www\ur
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\abc\Documents\uniform\UniServer\www\npmcache\c14291c8-che-ansi-regex-0-2-
1-package-tgz.lock
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open 'C:\Users\abc\Documents\uniform\UniServer\www\npmcache\c14291c
8-che-ansi-regex-0-2-1-package-tgz.lock'
npm ERR! not ok code 0
I get this error while running cmd as administrator. I've read in other SO posts that this may represent a missing program. git is installed and works so it's not that. bower is installed and works. I've tried adding c:\windows\system32 to the system PATH. No help. As you may be able to tell, I modified the location of my NPM cache thinking that perhaps the folder it was in by default had some sort of permissions issue. No help there either. I've tried adding the --no-bin-links option, doesn't help. I'm really at a loss as to what is causing this problem. Have the same issue trying to install slush-mongo, either globally or locally.

I had the same problem and found these command-line flags that seem to fix it without having to disable AV:
npm install --cache-lock-retries 1000 --cache-lock-wait 100000
You can change the default values (so you don't need to add the command-line options every time) by running:
npm config set cache-lock-retries 1000
npm config set cache-lock-wait 100000

Turns out that our company's anti-virus software was actually causing it. We attempted to do exclusions of node.exe and our working directory but both were insufficient. We have to disable the AV software, perform the install, and then re-enable AV.

I had the same problem, Which I was able to resolve by opening the command prompt or GIT Bash using RUN AS ADMINISTRATOR OPTION.
STEP 1: Right click on cmd.exe (search cmd in windows) or GIT Bash.
STEP 2: Click on Run as Administrator.
STEP 3: Execute >npm install command

Related

checkPermissions and path Errors on installation

I am trying to install firebase and create-react-native-app on my terminal and keep getting the same errors on my terminal. Can someone please explain to me the root of my issue and a solution.
Please explain how i might be able to change my permissions
npm install -g create-react-native-app
npm install firebase-tools -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/matthewsixt/.npm/_logs/2018-12-21T18_46_00_558Z-debug.log
Can someone please explain to me the root of my issue
npm is trying to write to a directory it doesn't have permission to write to.
Please explain how i might be able to change my permissions
As you can read on the npm docs, if you see an EACCES error when you try to install a package globally, you can either manually change npm’s default directory or reinstall npm with a node version manager.
Change npm’s default directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
This creates a directory for global installations and configures npm to use the new directory path. Then create a ~/.profile file (or open it if one exists) and add:
export PATH=~/.npm-global/bin:$PATH
Reload your shell, then reattempt your install to check that it is working:
source ~/.profile
npm i -g create-react-native-app
Use a version manager
This is my preferred option, as you can install as many versions of Node and npm as you like and change between them at will. It also totally negates the permissions issue.
The version manager I use is nvm. To install it, there is a handy one-liner using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
To verify the install:
command -v nvm
which should output 'nvm' if the installation was successful.
There are also a bunch of other installation methods listed on the project's homepage.
Once you have it installed, you can see what versions of Node are available with:
nvm ls-remote
And install a version using:
nvm install xx.xx.xx
(where xx.xx.xx is the version number).
If you'd like to read more about using nvm, this article is helpful: Installing Multiple Versions of Node.js Using nvm.
Using sudo
You'll probably find that prefixing sudo to your command fixes the issue. However, please don't do this.
Installing random code from the internet with admin rights is a really, really bad idea.

Error installing and using laravel mix

I want to install Mix in laravel . I run "npm install --no-bin-links" in my IDE terminal or in CMD but I get this error: (my laravel version is 5.4.27)
D:\wamp64\www\laravelProject>npm install --no-bin-links
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--no-bin-links"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! Maximum call stack size exceeded
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! D:\wamp64\www\laravelProject\npm-debug.log
I found!!
I remove node-modules then removed package-lock.json and ran
The following command helped me too:
npm cache clean --force
Also, you might need to add sudo in linux.

Any suggestions how to install grunt in windows behind a proxy?

I'm trying to install grunt on a windows machine that is behind a corporate proxy.
I have installed node and npm, I can see the versions of both of them from the command line. But when I try to install grunt as is described in the grunt site http://gruntjs.com/getting-started but I get the following errors and I can't figure it out how to solve it.
Here is the Error message I get:
npm.cmd: npm ERR! Error: CERT_UNTRUSTED
At line:1 char:4 + npm <<<< install -g grunt-cli + CategoryInfo : NotSpecified:
(npm ERR! Error: CERT_UNTRUSTED:String) [], RemoteException + FullyQualifiedErrorId:
NativeCommandError
npm ERR! at SecurePair.<anonymous> (tls.js:1367:32), npm ERR! at SecurePair.emit (events.js:92:17), npm ERR! at SecurePair.maybeInitFinished (tls.js:979:10), npm ERR! at CleartextStream.read [as _read] (tls.js:471:13), npm ERR! at CleartextStream.Readable.read (_stream_readable.js:340:10), npm ERR! at EncryptedStream.write [as _write] (tls.js:368:25)
npm ERR! at doWrite (_stream_writable.js:225:10), npm ERR! at writeOrBuffer (_stream_writable.js:215:5), npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:182:11), npm ERR! at at write (_stream_readable.js:601:24), npm ERR! If you need help, you may report this *entire* log, npm ERR! including the npm and node versions, at: npm ERR! <http://github.com/npm/npm/issues>, npm ERR! System Windows_NT 6.1.7601, npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "grunt-cli"
npm ERR!cwd C:\Dev\gruntTest2, npm ERR! node -v v0.10.31, npm ERR! npm -v 1.4.23
I am using visual studio 2013. I have tried installing direct from the command line and from the Package Manager Console, and basically I get the same error.
Any suggestions how to solve this?
Thanks in advance.
In order to be able to install grunt or anything else from npm, first I need to use the following command:
npm config set strict-ssl false
I found this answer in different places around stackoverflow and other sites. But I used as a reference Ramesh answer. I also include the proxy address of the network, but that didn't work until I change strict-ssl configuration.
You could run a proxy on your own system ( fiddler can function as a proxy)
and point your browser proxy settings to this proxy.
Because fiddler is started under your credentials, proxy authentication is no longer a problem.
Remember to restart programs after you change the proxy settings

NPM install fails

I am currently unable to install NPM on Mac OS, I have looked all over the place for someone with the same error, but I can't seem to find any. Could anyone give me a hand? This is what I get after running the curl command to install NPM:
All clean!
npm-install-94139.sh: line 302: 94407 Segmentation fault: 11 "$node" cli.js rm npm -gf
npm ERR! addLocal Could not install .
npm ERR! Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR! { [Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.5.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.1.71
npm ERR! path /Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Volumes/MacintoshHD/Users/Sebastian/.npm/3a52ce78-.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/52/msjnslgn4qnfjgxfvg28f8kc0000gn/T/npm.94143/package/npm-debug.log
npm ERR! not ok code 0
It failed
The solution on this other question seems better than messing around with NVM - npm throws error without sudo
SOLUTION:
You need to unlock permissions in home directory, like Noah says.
sudo chown -R `whoami` ~/.npm
You also need to write it to your library as well, like Xilo says.
sudo chown -R `whoami` /usr/local/lib/node_modules
My guess is that a directory used by npm (maybe /usr/local or something in your home folder) has the wrong permissions. Installing with sudo might work now but it can also bite you later since you'll definitely create files and directories as root, possibly causing problems later when npm tries to cache things.
My advice would be to uninstall, then reinstall via nvm instead. This does a great job of managing different node versions under ~/.nvm without having to use sudo.
Try clearing npm cache with
npm cache clean
Hope that helps.
when all else fails, clear you cache
Did you try "sudo" with your curl command?
Also, if you install a new version of Node, it now includes NPM, so you don't have to even install NPM separately..
From the NPM readme file: https://npmjs.org/doc/README.html
SUPER EASY INSTALL
npm comes with node now.
Windows Computers
Get the MSI. npm is in it.
Apple Macintosh Computers
Get the pkg. npm is in it.
Other Sorts of Unices
Run make install. npm will be installed with
node.
If you want a more fancy pants install (a different version, customized paths, etc.) then read on...

Mac npm erroring with ENOENT

I'm a recent convert to Mac from Windows, and currently just trying to get my tools setup.
I first installed node using homebrew, which was giving me errors (same as what I still have). I later removed node using homebrew and installed using the pkg from the node website.
I can access node in the command line and npm. The problem is when I try to install modules on the project locally I get something like:
npm install grunt-contrib
Error extracting archive { [Error: ENOENT, open '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip']
errno: 34,
code: 'ENOENT',
path: '/Users/davidmckeown/dev/adt-com/node_modules/grunt-contrib/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip' }
Another message just above that contains:
npm ERR! phantomjs#0.2.6 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR!
npm ERR! Failed at the phantomjs#0.2.6 install script.
npm ERR! This is most likely a problem with the phantomjs 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 phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.2.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib"
npm ERR! cwd /Users/davidmckeown/dev/adt-com
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
Any help figuring out what is causing problems here would be fantastic. This happens with other modules too, from what I can tell.
npm cache clean
or if installed under su
sudo npm cache clean
There was an issue 5 months ago with grunt qunit package - https://github.com/gruntjs/grunt-lib-phantomjs/issues/5.
Try to install this specific package:
sudo npm install grunt-contrib-qunit
The package that you installed is a bundle of many packages. The qunit package version was not updated explicitly to the latest version in this bundle, that's why clearing the npm cache might solve this issue.

Resources