美文网首页
CentOS 安装、配置 nodejs(及 npm)

CentOS 安装、配置 nodejs(及 npm)

作者: hemiao3000 | 来源:发表于2022-02-28 15:20 被阅读0次

最简单的方案是通过 yum 安装 nodejs ,不过 yum 源中的版本较老<small>(10.24.0)</small>,当前(2021-04-01)最新的长期支持版是 14.16.0 。因此,如果你想安装最新版本的 nodejs,那么就不能从原始的 yum 源安装。

  1. 删除已安装的 nodejs

    yum remove -y pure nodejs
    
  2. 添加 node.js Yum 源

    curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -
    
  3. 安装 nodejs

    yum install -y nodejs
    
  4. 验证

    node -v
    
    npm -v
    
  5. 设置 npm 的淘宝源,并验证

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

相关文章

网友评论

      本文标题:CentOS 安装、配置 nodejs(及 npm)

      本文链接:https://www.haomeiwen.com/subject/vmplrrtx.html