输入以下命令

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

然后

sudo apt-get install npm

https://askubuntu.com/questions/1088662/npm-depends-node-gyp-0-10-9-but-it-is-not-going-to-be-installed