Linux – npm install can’t access folder (no Permission)

githublinuxpermissionsruntime errorubuntu 14.04

i'm trying to install storjshare-daemon on ubuntu and i'm following the guide but when i'm using npm it keeps showing the same error , i try everything like setting public key on github and Check Ownership of the folders and the unsafe flag but it's not working , if anyone tell me what's wrong it wouled help me a lot , thanks .

using : ubuntu 14.04 (server) as root

npm install --global storjshare-daemon

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

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-12-26T17_57_58_681Z-debug.log

Best Answer

I've just experienced a similar permission problem with a npm install. Even if i created the folder and did chown and chmod, it ended with this permission error.

Here what worked for me:

login as root - sudo su

run npm install command with sudo

Not sure if it's the same problem i had, but worth a try..