记一次Ubuntu安装npm报错解决方案(node-gyp (>= 0.10.9) but it is not going to be installed)

本文介绍了解决node-gyp安装过程中遇到的问题及依赖缺失的处理方法,包括如何正确安装必要的依赖包,如libssl-dev、nodejs-dev等。

报错提示

 node-gyp : 依赖: nodejs-dev 但是它将不会被安装
            依赖: gyp (>= 0.1+20150913git1f374df9) 但是它将不会被安装
            推荐: build-essential 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

使用下面命令安装

sudo apt install aptitude
sudo aptitude install npm

遇到如下

     Keep the following packages at their current version:
1)     libssl-dev [Not Installed]                         
2)     node-gyp [Not Installed]                           
3)     nodejs-dev [Not Installed]                         
4)     npm [Not Installed]     

Accept this solution? [Y/n/q/?] ?

先N再Y

sudo apt install nodejs npm --reinstall Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: nodejs : Conflicts: npm npm : Depends: node-agent-base but it is not going to be installed Depends: node-archy but it is not going to be installed Depends: node-cacache (>= 17) but it is not going to be installed Depends: node-chalk (>= 5.1.2-2~) but it is not going to be installed Depends: node-cli-table3 Depends: node-columnify but it is not going to be installed Depends: node-cssesc Depends: node-debug but it is not going to be installed Depends: node-emoji-regex Depends: node-gyp but it is not going to be installed Depends: node-http-proxy-agent Depends: node-https-proxy-agent but it is not going to be installed Depends: node-mkdirp but it is not going to be installed Depends: node-ms but it is not going to be installed Depends: node-nopt but it is not going to be installed Depends: node-normalize-package-data but it is not going to be installed Depends: node-npm-bundled but it is not going to be installed Depends: node-npm-normalize-package-bin Depends: node-npm-package-arg (>= 10) but it is not going to be installed Depends: node-npmlog but it is not going to be installed Depends: node-postcss-selector-parser Depends: node-read-package-json but it is not going to be installed Depends: node-rimraf but it is not going to be installed Depends: node-semver but it is not going to be installed Depends: node-string-width but it is not going to be installed Depends: node-strip-ansi but it is not going to be installed Depends: node-tar but it is not going to be installed Depends: node-validate-npm-package-name but it is not going to be installed Depends: node-which but it is not going to be installed Depends: nodejs:any Recommends: git but it is not going to be installed Recommends: node-tap but it is not going to be installed E: Unable to correct problems, you have held broken packages.
最新发布
11-10
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值