devenv icon indicating copy to clipboard operation
devenv copied to clipboard

npm install -g failed

Open Paul75 opened this issue 2 years ago • 6 comments

Describe the bug When I install a programme with npm like : npm install -g <APP>

It failed. I've got an error forbidden :

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /nix/store/bkb1nlibmvz2iys8b6lmb386yr021nlv-nodejs-16.20.2/lib/node_modules/generator-ngx-rocket
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/nix/store/bkb1nlibmvz2iys8b6lmb386yr021nlv-nodejs-16.20.2/lib/node_modules/generator-ngx-rocket'
npm ERR!  [Error: EACCES: permission denied, mkdir '/nix/store/bkb1nlibmvz2iys8b6lmb386yr021nlv-nodejs-16.20.2/lib/node_modules/generator-ngx-rocket'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/nix/store/bkb1nlibmvz2iys8b6lmb386yr021nlv-nodejs-16.20.2/lib/node_modules/generator-ngx-rocket'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pkbp512/.npm/_logs/2023-09-19T09_03_45_878Z-debug-0.log

To reproduce

launch a terminal go to project and do : npm install -g generator-ngx-rocket

Version

devenv: 0.6.3

Paul75 avatar Sep 19 '23 09:09 Paul75

Running npm config set prefix / should fix it.

domenkozar avatar Sep 19 '23 10:09 domenkozar

What can be done in this regard to automate this step as part of devenv shell first run?

mahmoudajawad avatar Aug 21 '24 05:08 mahmoudajawad

@mahmoudajawad why do you need to globally install something?

domenkozar avatar Aug 21 '24 09:08 domenkozar

@domenkozar, many javascript frameworks have CLI tooling that is provided separately from the actual framework elements. If installing the tooling is not possible with devenv, then the environment user would still be required to install npm (or any package manager), then install the CLI tools in order to have complete experience.

Does devenv suggest different workflow?

mahmoudajawad avatar Aug 21 '24 11:08 mahmoudajawad

It's to install the tooling locally and export PATH to make it available within the shell.

domenkozar avatar Aug 21 '24 14:08 domenkozar

@domenkozar I see. This means different folder structure in some cases (some CLIs conflict with project files). But, overall it makes sense.

mahmoudajawad avatar Aug 22 '24 08:08 mahmoudajawad