Answer the question
In order to leave comments, you need to log in
Why does npm need sudo?
I go to VPS:
[email protected]:[~]$ npm config get prefix
/home/vpsuser/.nvm/versions/node/v7.6.0
[email protected]:[~]$ npm install [email protected] -g
......... Все ОК .........
"scripts": {
"preinstall": "npm i -g pm2 apidoc jsdoc eslint babel-cli"
}
"scripts": {
"preinstall": "sudo npm i -g pm2 apidoc jsdoc eslint babel-cli"
}
Answer the question
In order to leave comments, you need to log in
I don’t think I will open America to anyone, but if npm packages are installed globally (key -g), then they are installed in system directories, and this requires superuser rights.
It's all about the -g switch, which says that the package must be installed globally in the system.
"preinstall": "npm i pm2 apidoc jsdoc eslint babel-cli"
will work as you would expect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question