4

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

2 Answers 2

4

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..

2
  • Thank you very much , i can't believe the solution is so simple , i've searched for hours online but all of the answers didn't work , thanks again
    – y.h.
    Commented Dec 26, 2017 at 21:39
  • it does not work for me, I am on Linux lite Commented Jan 14, 2022 at 6:13
0

Instead of installing npm files in the root home and running as root which is a security concern. Consider using and .npmrc file and specifying the cache directory to be local to the code repo. Use a differnent user with only required permissions. Then your .npmrc file can look like so:

cache=./.npm

Then when you run npm install or npm build it will create a .npm directory relative to your code repository.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .