小虾虎鱼

小虾虎鱼

Deepin 20 安装Nodejs

作者 禾惠 发表于 2020/05/06 14:57 ,最后修改于 2020/09/13 21:45

Nodejs在Linux系统上安装方法(官方)

按照官方的方式执行 curl -sL https://deb.nodesource.com/setup_12.x | bash - 后出现错误提示:

## Confirming "n/a" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/n/a/Release'

## Your distribution, identified as "n/a", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

解决方法:

  1. 编辑文件:sudo vim /etc/apt/sources.list.d/nodesource.list
  2. 输入内容
    deb https://deb.nodesource.com/node_12.x buster main
    deb-src https://deb.nodesource.com/node_12.x buster main
    
    如果上面镜像慢可以换清华大学的镜像源:
    deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_12.x buster main
    deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_12.x buster main
    
  3. 执行 sudo apt update
  4. 安装nodejs sudo apt install -y nodejs

2020-09-13补充(上面方法可能会存在提示没有验证的问题导致安装失败)

  1. 打开地址 https://deb.nodesource.com/setup_12.x并保存到本地
  2. 将setup_12.x文件添加可执行权限
  3. 用编辑器打开setup_12.x文件将 DISTRO=$(lsb_release -c -s) 修改成 DISTRO="xenial"
  4. 执行setup_12.x脚本

我欣赏你的好品味~

打开微信扫一扫