I install nodejs and npm.
but now I want to update to the latest version, i tried many ways but it didn’t work.
I install nodejs and npm.
but now I want to update to the latest version, i tried many ways but it didn’t work.
For Node.js Upgrade:
Linux/Mac:
The module n makes version-management easy:
sudo npm install n -g
For the latest stable version:
sudo n stable
For the latest version:
sudo n latest
Windows:
Just reinstall node from the .msi in Windows from the node website.
For NPM Upgrade:
Kindly go through npm documentation for windows update.
For Linux/Mac:
You can upgrade to the latest version of npm using:
npm install -g npm@latest
Or upgrade to the most recent release:
npm install -g npm@next
managing node versions is easy with nvmfor linux or nvm for windows.
the docs for how to install them are available at their respective github repos.
Nvm is a script-based node version manager. You can install it easily with a curl and bash one-liner as described in the https://github.com/nvm-sh/nvm. It's also available on Homebrew.
$ nvm install node --reinstall-packages-from=node