Member-only story
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:
yarn set version latest
Addon: How To Check The Version for NVM, NPM, Node, and NPX
Use the following command to check the version for NVM, NPM, Node, and NPX:
echo nvm npm node npx yarn && nvm --version && npm -v && node -v && npx -v && yarn -v
If you’ve any feedback, don’t hesitate to get in touch with me about what I can improve or provide better examples.
Follow me on Twitter and GitHub for more code snippets, posts, updates.
Also, you can check out my YouTube Channel.
Thanks! Happy coding! 👋🏼