天天看点

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