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/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 plete 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/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 plete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-04-11T06_47_05_916Z-debug.log
What i tried:
pletely 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.
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./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 plete 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./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 plete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-04-11T06_47_05_916Z-debug.log
What i tried:
pletely 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.
Share Improve this question edited Apr 11, 2018 at 7:06 Sarath Kumar asked Apr 11, 2018 at 6:59 Sarath KumarSarath Kumar 1,1462 gold badges18 silver badges42 bronze badges 7- try sudo npm install – Basil Battikhi Commented Apr 11, 2018 at 7:04
- @BasilBattikhi I'm already sudo user. That's why I didn't care about added sudo at the beginning. But I tried worked! – Sarath Kumar Commented Apr 11, 2018 at 7:09
- you tried what ? – Basil Battikhi Commented Apr 11, 2018 at 7:09
- @BasilBattikhi sudo npm install – Sarath Kumar Commented Apr 11, 2018 at 7:10
- does the problem resolved now ? – Basil Battikhi Commented Apr 11, 2018 at 7:10
2 Answers
Reset to default 4try sudo npm install
even if you are working on sudo user
Use the latest npm
npm install -g npm