1. 首页
  2. Web

安装依赖提示未知命令Ubuntu上安装yarn和npm

(碎碎念:ubuntu使用起来,需要设置很多权限,真麻烦emm)
项目安装依赖的时候输入yarn命令时,系统提示没有这个命令,建议我安装cmdtest,提示如下:

apt install cmdtest

这并不是我要的,我要安装的是yarn包,所以输入以下命令安装。

sudo apt install yarn

然后使用npm命令也提示没有这个命令,提示如下:

我还需要安装npm包,以下命令。

sudo apt install npm

如果执行上面的安装命令会报错:

Reading package lists... Done
Building dependency tree
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:
npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

执行如下命令能解决上面的问题:

sudo apt-get install nodejs-dev node-gyp libssl1.0-dev

再次执行一次npm安装命令即可:sudo apt install npm

[送杯奶茶]
  • 版权声明:本文基于《知识共享署名-相同方式共享 3.0 中国大陆许可协议》发布,转载请遵循本协议
  • 文章链接:https://www.imiowo.com/459.html [复制] (转载时请注明本文出处及文章链接)
上一篇:
:下一篇
又是元气MAX的一天(●'◡'●)

作者:秫米

秫米
介绍:来一起坐下喝杯奶茶!

文章:77篇

最后更新:23-11-01

发表评论

gravatar

当前页面评论被关闭,原因如下: