【Node】Deepin和Centos 简单快速安装Node和npm和pnpm

1.deepin 进行安装

安装npm

sudo apt install npm

安装node

sudo npm install -g n

升级node到稳定版

sudo n stable

升级到最新版

sudo n latest

升级npm到最新版

sudo npm install npm@latest -g

pnpm的安装

npm install pnpm -g

2.centos 7进行安装

  • 进入官网进行下载
  • https://nodejs.org/en/
  • 【Node】Deepin和Centos 简单快速安装Node和npm和pnpm_第1张图片
wget https://nodejs.org/dist/v16.17.1/node-v16.17.1-linux-x64.tar.xz

创建目录 /usr/local/node/

mkdir -p  /usr/local/node/
cp node-v16.17.1-linux-x64.tar.xz  /usr/local/node/
cd /usr/local/node/
tar xvf node-v16.17.1-linux-x64.tar.xz
mv node-v16.17.1-linux-x64 node16-17

创建软链接

ln -s /usr/local/node/node16-17/bin/node /usr/local/bin/node
ln -s /usr/local/node/node16-17/bin/npm /usr/local/bin/npm

执行命令

node -v
npm -

pnpm的安装

npm install pnpm -g

【Node】Deepin和Centos 简单快速安装Node和npm和pnpm_第2张图片

如果出现上面的错误

==> Extracting pnpm binaries 7.12.2
Copying pnpm CLI from /tmp/tmp.lhZRV3nqMv/pnpm to /root/.local/share/pnpm/pnpm
Appended new lines to /root/.bashrc

Next configuration changes were made:
export PNPM_HOME="/root/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"

To start using pnpm, run:
source /root/.bashrc

root@localhost tmp.lhZRV3nqMv]# cp /tmp/tmp.lhZRV3nqMv/pnpm /root/.local/share/pnpm/pnpm 
cp:是否覆盖"/root/.local/share/pnpm/pnpm"? y
[root@localhost tmp.lhZRV3nqMv]# vim /root/.bashrc 
[root@localhost tmp.lhZRV3nqMv]# source /root/.bashrc 
[root@localhost tmp.lhZRV3nqMv]# pnpm -v

【Node】Deepin和Centos 简单快速安装Node和npm和pnpm_第3张图片

你可能感兴趣的:(npm,前端,javascript)