Can't update npm - code EN0ENT -2 - node.js

I just used Homebrew to install Node. It seemed alright but when I try to update npm with
npm install -g npm
I get the following error:
ERR! addLocal Could not install /Users/myusername/-g
ERR! Darwin 14.3.0
ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "npm"
ERR! node v0.12.7
ERR! npm v2.14.2
ERR! path /Users/myusername/-g
ERR! code EN0ENT
ERR! errno -2
ERR! enoent EN0NT, open '/Users/myusername/-g'

This worked for me in the past with a similar issue:
npm cache clean
You can also try running it as sudo
sudo npm install -g npm

Related

npm returns module_not_found on react-native-cli install

I just upgraded my mac pro to Sierra, and now I am trying to install React Native:
sudo npm install -g react-native-cli
This command fails and I get this message:
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'github-url-from-git'
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! /Users/gianni/npm-debug.log
npm -v: 3.10.10
node -v: v6.11.0
Thanks

npm install express isn't working still

I entered "sudo npm install -g express-generator" which threw errors back at me.
I then checked issues like this on Stackoverflow and found none were successful.
The things I tried were:
"sudo chown -R username ~/.npm" and "npm cache clean"
but it's throwing an error back:
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
"express-generator" "-g"
npm ERR! node v6.6.0
npm ERR! npm v3.10.8
npm ERR! uid must be an unsigned int
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "- g" "express-generator"
npm ERR! node v6.6.0
npm ERR! npm v3.10.8
It's a known issue with node 6.6.0 and npm 3.10.8. Have you tried downgrade to 3.10.3?
npm install -g npm#3.10.3
or updating node?

Errors Installing Ionic Framework on Mac

When trying to install ionic framework on my mac via node.js using the command $ npm install -g cordova ionic I am getting the following errors
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v0.12.5
npm ERR! npm v2.12.0
npm ERR! Attempt to unlock /usr/local/lib/node_modules/cordova, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v0.12.5
npm ERR! npm v2.12.0
npm ERR! Attempt to unlock /usr/local/lib/node_modules/ionic, which hasn't been locked
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! /Users/kernelliott/npm-debug.log
Any idea as to why I am getting these errors?
Use sudo as you are installing in system directory (with the -g, global flag):
sudo npm install -g cordova ionic

Installing grunt-cli package through npm fails on Windows

I can't install grunt on windows 7
I'm trying to install it via this command:
npm install ‐g grunt‐cli
But it gives me the following error:
C:\Windows\System32>npm install -g grunt-cli
npm ERR! addLocal Could not install C:\Windows\System32\-g
npm ERR! addLocal Could not install C:\Windows\System32\grunt-cli
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" "-g" "grunt-cli"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! path C:\Windows\System32\-g
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! enoent ENOENT, open 'C:\Windows\System32\-g'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\System32\npm-debug.log
Change the order of arguments from:
npm install ‐g grunt‐cli
to
npm install grunt-cli -g
Cheers!

Trying to install yo with npm on Windows

I am on Windows and am trying to follow the instructions at http://yeoman.io/learning/index.html. So far I have successfully installed grunt-cli and bower but when I try to install yo using the following command...
npm install -g yo
...the command prompt returns this:
> spawn-sync#1.0.11 postinstall C:\Users\Aaron\AppData\Roaming\npm\node_modules\yo\node_modules\cross-spawn\node_modules\spawn-sync
> node postinstall
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" "install" "-g" "yo"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! file ;C:\Windows\system32\cmd.exe
npm ERR! path ;C:\Windows\system32\cmd.exe
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn ;C:\Windows\system32\cmd.exe
npm ERR! spawn-sync#1.0.11 postinstall: `node postinstall`
npm ERR! spawn ;C:\Windows\system32\cmd.exe ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync#1.0.11 postinstall script 'node postinstall'.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Aaron\AppData\Roaming\npm\node_modules\npm-debug.log
Does anyone have any idea what the hell this means and how I can fix it?
You can try with this : https://github.com/npm/npm/issues/7781
I think this will helps you to solve your question.
And to get node & npm in cmd. You can set node location in windows environment variable. Then restart your cmd & try again to do this.
Try re-installing the setup with feature npm package manager and then get back to your npm install.

Resources