Ubuntu 18.04 LTS,安装Node.js,遇到npm不成功的问题:
Depends: node-gyp (>= 0.10.9)  

总结一下安装的命令:

Ubuntu Server 18.04 Node.js and npm install 

sudo apt remove --purge nodejs npm
sudo apt clean
sudo apt autoclean
sudo apt install -f
sudo apt autoremove

Find the latest version at https://github.com/nodesource/distributions#debinstall Latest version 10.x now

 

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install yarn

npm -version
6.4.1
nodejs -v
v10.15.1