Cannot install last version of cli on Ubuntu

Hi,
I have an error with node-gyp while installing uns cli :

# npm i -g @uns/cli
/root/.nvm/versions/node/v12.19.1/bin/uns -> /root/.nvm/versions/node/v12.19.1/lib/node_modules/@uns/cli/bin/run

> bcrypto@5.3.0 install /root/.nvm/versions/node/v12.19.1/lib/node_modules/@uns/cli/node_modules/bcrypto
> node-gyp rebuild

sh: 1: node-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! bcrypto@5.3.0 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bcrypto@5.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-16T20_03_16_945Z-debug.log

build essential and python3 are both installed :

# apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.8ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
# apt-get install python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3 is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Environnement :

  • OS : Ubuntu 20.04.1 LTS (Focal Fossa)
  • NodeJs : v12.19.1
  • NPM : 6.14.8

Thanks for support :slight_smile:

Adrien

This is probably the most important thing to consider.
Are you running this command as root?

Yep I’m using the root user of my Ubuntu machine that’s why I don’t understand this error :frowning:

@dlecan ok I found a solution : https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/
Run :
npm config set user 0

:slight_smile:

1 Like

It is not really safe to run all these commands as root. You should run them with another user, it would work the same (with nvm too).

Anyway, it’s working :smile:!

1 Like

Yep I know that but I only have uns forger node on my server and I trust you :stuck_out_tongue:
And the dependencies you’ve chosen :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.