简体   繁体   中英

NPM install is not working [code 128]

NPM is not working it's giving permission denied error. Here is the full log:

npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/jonschlinkert/resolve-file.git /root/.npm/_cacache/tmp/git-clone-8b5c9e7d
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-8b5c9e7d': Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-11T06_46_34_324Z-debug.log
root@ip-172-31-15-60:/var/www/html/itracker# npm install request
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/jonschlinkert/resolve-file.git /root/.npm/_cacache/tmp/git-clone-77c3de2c
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-77c3de2c': Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-11T06_47_05_916Z-debug.log

What i tried:

  • completely removed node and NPM and installed.

    sudo chown -R $(whoami) ~/.npm

by following the answer from here: npm throws error without sudo

Note:

I tried to install globally is working. But installing locally is not working. I tried both sudo and normal user.

即使您正在使用sudo用户,也请尝试sudo npm install

使用最新的npm

npm install -g npm 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM