sudo: npm: command not found

前端 未结 25 2665
渐次进展
渐次进展 2020-11-28 01:19

I\'m trying to upgrade to the latest version of node. I\'m following the instructions at http://davidwalsh.name/upgrade-nodejs

But when I do:

sudo np         


        
25条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 01:44

    If you installed node/npm with nvm, the nvm environment configuration file has to be run before you can use either package.

    This is generally found in ~/.nvm/nvm.sh.

    To run this automatically, include:

    source ~/.nvm/nvm.sh
    

    in the .bash_profile file for your user

    If you then want to use sudo with that user, make sure to include the -i parameter to make sudo set the user environment. eg

    sudo -iu jenkins npm install grunt-cli
    

提交回复
热议问题