How can I update NodeJS and NPM to the next versions?

后端 未结 30 1971
北荒
北荒 2020-11-22 08:07

I just installed Node.js and npm (for additional modules).

How can I update Node.js and the modules which I\'m using to the latest versions

30条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 09:04

    I found this really neat way of updating node on David Walsh's blog, you can do it by installing n:

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    

    It will install the current stable version of node.


    EDIT: Please don't use n anymore. I recommend using nvm. You can simply install stable by following the commands below:

    nvm ls-remote
    nvm install  
    nvm use 
    

提交回复
热议问题