我试过运行sudo apt-get install npm
它会在下面返回此对话框。我该如何解决这个问题?
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.
答案 0 :(得分:4)
npm与nodejs一起安装。如果您安装了节点,那么您也有npm。
运行node -v
检查节点是否已安装,然后运行npm -v
为npm执行相同操作。
如果未安装nodejs,请在此处查看安装说明: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
6.x是当前的稳定分支。
通常,要运行擦除现有节点/ npm安装并从头开始安装,请运行:
sudo apt remove --purge nodejs node npm
sudo apt clean
sudo apt autoclean
sudo apt install -f
sudo apt autoremove
答案 1 :(得分:0)