我收到了这个错误。
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.
我尝试了很多来源。但无法解决错误。由于此错误,我尝试安装node-gyp。但当时它显示出另一种依赖性。那么有没有办法一次安装依赖项?
答案 0 :(得分:0)
删除旧版本的节点和npm,并尝试使用以下步骤使用节点版本管理器安装较新版本,然后尝试安装软件包。
//Remove node
sudo apt-get purge --auto-remove nodejs npm
//Remove any leftover files that gives version issues
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
//Install nvm, this will install npm 5.4
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
//To uninstall a node version
//nvm uninstall <version>
nvm install <version you want>
nvm use <version you installed>
//check with
node -v
npm -v