YJK

独立世界

Independent World
twitter
telegram

Install Node.js using n/nvm

n supports installing Node.js on macOS, Linux (including WSL), and the usage is very simple:

n#

bash <(curl -L https://raw.githubusercontent.com/tj/n/master/bin/n) lts

Or for easier input

bash <(curl -L mayi.ee/n) lts

You can replace lts with the following versions:

  • lts - Long-term support version (recommended)
  • latest, current - Latest version
  • 10.16.0 or other specified versions

For more information, please visit the n Github page: https://github.com/tj/n


Using n in China

export NODE_MIRROR=http://mirrors.cloud.tencent.com/nodejs-release/
# Then execute the n command normally bash <(curl -L mayi.ee/n) lts

nvm#

n is simple but requires root permissions, while installing node through nvm does not require root user to install. To install nvm:

curl -L https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

Or for easier input

curl -L mayi.ee/nvm | bash

To install the latest version of Node.js:

  • nvm install node
  • nvm use node

To install the latest LTS version of Node.js:

  • nvm install --lts
  • nvm use --lts

To install a specific version of Node.js:

  • nvm install 14.7.0
  • nvm use 14.7.0

Using nvm in China

export NVM_NODEJS_ORG_MIRROR=http://mirrors.cloud.tencent.com/nodejs-release
# Then execute the nvm command normally nvm install --lts
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.