web-dev-qa-db-fra.com

Ubuntu 18.04 LTS Server npm: Dépend de: node-gyp (> = 0.10.9) mais il ne va pas être installé

Mon environnement est un peu différent. J'ai mis à jour du 14.04 au 16.04 au 18.04.

Npm est installé sur mon ordinateur de bureau 18.04.

$ npm -version
3.5.2

# nodejs -v
v8.10.0

# apt install npm 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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.
14
iyagi

Ubuntu Server 18.04 Node.js et npm install

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

Trouvez la dernière version sur https://github.com/nodesource/distributions#debinstall Dernière version 10.x maintenant.

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.1.0
nodejs -v
v10.7.0
30
iyagi