How To Upgrade NVM, NPM, Node, and NPX
As a “backender” in the world of ̶J̶a̶v̶a̶S̶c̶r̶i̶p̶t̶ frontend, I was looking for commands and options on keeping versions of core components consistent. That’s mainly about NVM, NPM, Node.js, and NPX.
NVM.
At the moment (16 April 2022), the most recent version of NVM is v0.38.0, and to install or update NVM use this command (I will keep this command updated):
# with curlcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash# or, with wgetwget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
NPM.
Install Node
brew update
brew install npm
To upgrade the version of NPM, use the following command:
npm install -g npm@latest
Node.
Once you have nvm installed you can use the following command to get the latest stable version of Node.js:
nvm install stable
NPX.
Since NPX is also a Node package we can use NPM to install or update it:
npm install -g npx
Yarn.
Install Yarn:
npm install -g yarn
If you want to upgrade the current installation of Yarn, use the following command: