How can I change the version of npm using nvm?

后端 未结 14 2187
温柔的废话
温柔的废话 2020-11-28 17:27

I\'ve been using NVM to install the latest versions of nodeJS for my node work. It works totally fine for installing separate versions and switching between them. It also in

14条回答
  •  旧时难觅i
    2020-11-28 18:13

    Changing npm versions on linux based OSs isn't a straight forward one command process yet. I have done following to switch back to older version of npm. This should work to get any version of npm working. First install the version of npm you want to use:

    sudo npm install -g npm@X.X.X
    

    Remove the sym link in /usr/local/bin/

    sudo rm /usr/local/bin/npm
    

    Recreate the sym link using the desired version of npm you have installed

    sudo ln -s /usr/bin/npm@X.X.X /usr/local/bin/npm
    

提交回复
热议问题