Today’s article falls into the category „reminder“. Every few months I write smaller projects with Node.js. But before I start, I’d like to update to the latest version, and that’s where the dilemma starts. Every time I forget the command line commands for it.
Therefore, here are the short and concise CMD/Shell/Bash commands for updating Node.js and NPM. Once for macOS (OSX) / Linux and once for Windows.
Update NPM on Linux and macOS (OS X)
sudo npm install -g npm
Whether the update was successful can be tested with the following command.
Update NPM on Windows
The following commands have to be set in Powershell (Start -> „powershell“ -> right click -> Run as Administrator). Each line corresponds to one command.
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g […]