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

后端 未结 30 1975
北荒
北荒 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 08:47

    If you're using Windows: Go to https://nodejs.org/en/download/, download latest .exe or .msi file and install to overwrite the old versions

    If you're using Ubuntu or Linux: Uninstall node.js first then reinstall, e.g with Ubuntu ():

    sudo apt-get remove nodejs
    
    # assume node.js 8 is latest version
    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install nodejs
    
    node -v
    npm -v
    

    Remove node_modules in your project folder and npm install to make sure your application will run well on new node and npm version.

提交回复
热议问题