NodeSource 安装Node.js
https://github.com/nodesource/distributions
目前centos7 支持 node16
安装后 包括了 nodejs 与 npm
npm 换源
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| 临时使用 npm --registry https:
持久使用 npm config set registry https:
通过cnpm npm install -g cnpm --registry= https:
使用官方镜像 npm config set registry https:
查看npm源地址 npm config get registry
|
npm 手动安装
- 官网下载 进入Node最新版下载 <https://nodejs.org/en/download/current/
1
| wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
|
- 解压
1
| tar -xvf node-v18.16.0-linux-x64.tar.xz
|
- 配置
1 2 3
| export NODEROOT=/usr/local/lib/node18.15 export PATH=$NODEROOT/bin:$PATH
|