centos8安装nodejs

文章目录

    • To install the Yarn package manager, run:

  1. 通过官方查询需要安装的版本
    https://github.com/nodesource/distributions

  2. 在CentOS下获取相应版本的nodejs资源(以NodeJS 14.x为例)
    粘贴 curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -

  3. 运行 sudo yum install -y nodejs 进行nodejs安装

You may also need development tools to build native addons:
sudo yum install gcc-c++ make

To install the Yarn package manager, run:

 curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
 sudo yum install yarn
  1. 确认安装成功

node -v

npm -v

  1. 安装cnpm

npm install -g cnpm -registry=https://registry.npm.taobao.org

  1. 修改cpm的源

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

  1. 查看源是否修改成功

npm config get registry

你可能感兴趣的:(centos8环境安装)