sudo apt-get install npm 未安装

Tom*_*Tom 3 ubuntu node.js npm npm-install

我尝试运行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.
Run Code Online (Sandbox Code Playgroud)

Mit*_*kos 6

npm 与 nodejs 一起安装。如果你安装了 node,你也有 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
Run Code Online (Sandbox Code Playgroud)