deepin或uos安装最新版nodejs出现Your distribution, identified as “n/a“错误解决

在尝试使用curl命令安装Node.js版本16时遇到错误,提示当前发行版‘n/a’不受支持。解决方案是通过wget下载安装脚本,手动修改DISTRO变量为'stable',然后执行安装命令。此外,还提供了配置npm全局配置的步骤,包括设置cache和prefix路径。
摘要由CSDN通过智能技术生成

  

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

使用以上脚本安装出现以下错误:

## 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

解决方法:

# 下载脚本
wget https://deb.nodesource.com/setup_16.x

下载脚本文件修改脚本DISTRO=$(lsb_release -c -s)为 DISTRO=stable,然后在执行以下命令 

sudo chmod +x setup_16.x
sudo ./setup_16.x
sudo apt-get install -y nodejs

配置npm全局配置:

#查看当前配置
npm config ls -l
#修改cache和prefix两个目录的配置
npm config set prefix "/opt/.npm/global/"
npm config set cache "/opt/.npm/cache/"

nodejs官方安装文档

Official Node.js binary distributions are provided by NodeSource.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值