Running npm update -g npm is deleting npm from usr/local/bin.
It gives this error and when I try to run it again using sudo it is gone.
as-MacBook-Air:~ a$ npm update -g npm
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rmdir
npm ERR! Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/npm'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/npm']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rmdir',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back syscall: 'rmdir',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/a/npm-debug.log
as-MacBook-Air:~ a$
permission denied, rmdir '/usr/local/lib/node_modules/npm'
try the command again with sudo:
sudo npm update -g npm
reinstall npm :
First uninstall node and remove node_modules. then install it again by homebrew
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
export PATH="$HOME/.node/bin:$PATH"
npm install -g http-server node-inspector forever nodemon
Try it with Sudo permissions or better try remove it and install a updated one.
Related
permission denied issue in mac while installing react-native-cli
The operation was rejected by your operating system.It is likely you do not have the permissions to access this file as the current user
npm install -g react-native-cli
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/react-native-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir
'/usr/local/lib/node_modules/react-native-cli'
npm ERR! [Error: EACCES: permission denied, mkdir
'/usr/local/lib/node_modules/react-native-cli'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/react-native-cli'
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/intersoft-admin/.npm/_logs/2021-11-10T09_56_34_035Z-debug.log
try this command
sudo npm install -g react-native-cli
npm install -g ethereumjs-testrpc not working it is showing error
npm ERR! Error: EACCES: permission denied, access
'/usr/local/lib/node_modules/ethereumjs-testrpc' npm ERR! at Error
(native) npm ERR! { [Error: EACCES: permission denied, access
'/usr/local/lib/node_modules/ethereumjs-testrpc'] npm ERR! errno:
-13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules/ethereumjs-testrpc' } 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! /home/user/npm-debug.log
sudo npm install -g ethereumjs-testrpc
You have to run this command as superuser otherwise it won't run . because it's trying to accessed your filesystem.
I'm following facebook's tutorial on getting started with React Native (https://facebook.github.io/react-native/docs/tutorial.html#hello-world), but I can't get the react-native-cli to install. Any help interpreting the error messages? Obviously it says to unlink something, but I don't know what it is linked to that it shouldn't be linked to.
Running as root seems to do something, but zsh still won't recognize the react-native command.
➜ ~ npm install -g react-native-cli
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /Users/bbarclay/.node/bin/react-native
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/bbarclay/.node/bin/react-native' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/Users/bbarclay/.node /bin/react-native'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/Users/bbarclay/.node/bin/react-native']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/Users/bbarclay/.node/bin/react-native' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/bbarclay/npm-debug.log
➜ ~ sudo npm install -g react-native-cli
Password:
/Users/bbarclay/.node/bin/react-native -> /Users/bbarclay/.node/lib/node_modules/react-native-cli/index.js
react-native-cli#0.1.4 /Users/bbarclay/.node/lib/node_modules/react-native-cli
└── prompt#0.2.14 (revalidator#0.1.8, pkginfo#0.3.0, read#1.0.6, winston#0.8.3, utile#0.2.1)
➜ ~ react-native init AwesomeProject
zsh: command not found: react-native
Add the admin permission to .npm home directory.
sudo chown -R $(whoami) ~/.npm
I man on Mac OSX and want to perform a npm update to update all globally installed stuff.
After executing npm update -g, I got a lot of erros and npm is gone, like this:
localhost:~ myname$ npm
-bash: npm: command not found
I Googled but don't remember how I installed node. It seems it's not installed via brew, so that I can't use brew to un/reinstall node/npm.
-- UPDATE --
After checking the comments on some other links I decide to just reinstall node and my npm is back. But when I try to use npm install -g npm to update again, the issue returns. Here is the full stuff from my terminal:
localhost:~ myname$ npm install -g npm
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "npm"
npm ERR! node v0.12.1
npm ERR! npm v2.5.1
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/myname/npm-debug.log
localhost:~ myname$ npm
-bash: /usr/local/bin/npm: No such file or directory
What should I do?
Thanks!
The error says literally: Please try running this command again as root/Administrator. It means you need to update/install with administrator privileges. To do so use "sudo":
sudo npm update -g
I've got problems trying to install NPM.
Always worked well, but now, i've to install "ionic" and the problem is that when i tried to re-install nodejs all work well, it seems that npm installed but trying to update it, it gives me errors, so i tried to update it via this command:
curl https://www.npmjs.org/install.sh | sh
I cannot install ionic, i don't know why. I've installed months ago cordova and phonegap, but ionic gives me trouble.
Reading guides, tell me to update my npm and doing this, that what i've (this is the following error using the command above)
cleanup prefix=/usr/local
All clean!
unbuild npm#1.4.14
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "rm" "npm" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
> npm#1.4.16 prepublish .
> node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test/*/*/node_modules && make -j32 doc
make: Nothing to be done for `doc'.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm#1.4.16 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
Solved using the command sudo su on my mac os x (so without using sudo with the commando or sudo $username).
then using the curl commando it run.
Thanks however.
Might this answer could be usefull
Try this:
rm -rf /usr/local/lib/node_modules/npm
sudo curl https://www.npmjs.org/install.sh | sh