天天看點

nodejs 安裝

方法 1

https://github.com/nodesource/distributions

Installation instructions

Node.js v15.x:

Using Ubuntu

curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -

sudo apt-get install -y nodejs

Using Debian, as root

curl -sL https://deb.nodesource.com/setup_15.x | bash -

apt-get install -y nodejs

Node.js v14.x:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

curl -sL https://deb.nodesource.com/setup_14.x | bash -

方法2:

通過n安裝nodejs:

安裝n工具

sudo npm i -g n

更新nodejs到最新

sudo n lts

其他

檢視版本

node -v

檢視源:

npm config get registry

npm修改源:

npm config set registry https://registry.npm.taobao.org