Reputation: 1024
npm ERR! Linux 3.4.0+ npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "lodash" npm ERR! node v5.10.1 npm ERR! npm v3.8.3 npm ERR! path /root/test/node_modules/.staging/lodash-9a2aabe2 npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall rename npm ERR! Error: EACCES: permission denied, rename '/root/test/node_modules/.staging/lodash-9a2aabe2' -> '/root/test/node_modules/lodash' npm ERR! at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7) npm ERR! at FSReqWrap.oncomplete (fs.js:82:15) npm ERR! npm ERR! Error: EACCES: permission denied, rename '/root/test/node_modules/.staging/lodash-9a2aabe2' -> '/root/test/node_modules/lodash' npm ERR! at Error (native) npm ERR! [Error: EACCES: permission denied, rename '/root/test/node_modules/.staging/lodash-9a2aabe2' -> '/root/test/node_modules/lodash'] 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! /root/test/npm-debug.log
Upvotes: 2
Views: 18044
Reputation: 1
Run this command in the terminal:
sudo chown -R 501:20 "/Users/johnsmith/.npm"
Replace johnsmith
and also replace 501:20
with your actual user and group IDs if they are different.
Then close the terminal and reopen the terminal.
Then run npm i {package name}
.
It should work correctly.
Upvotes: 0
Reputation: 11
For my case i run following command
sudo npm install -g <package name> --unsafe-perm=true --allow-root
Upvotes: 1
Reputation: 1263
For my case i run following command, for this permission denied issue:
1st:
sudo npm install -g npm@latest
2nd:
npm install -g [email protected]
3rd: check version:
ng version
Upvotes: 0
Reputation: 59
Install using this command
sudo npm install -g <package name> --unsafe-perm=true --allow-root
Upvotes: 5
Reputation: 66
install the npm package locally for your user, and if you have to install it globally, use sudo. e.g:
sudo npm install package -g
Upvotes: -1