I did the following steps:
git clone https://github.com/nibtehaz/NORTH-app.git
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install # which caused the following error
and got
The following packages have unmet dependencies:
nodejs : Conflicts: npm
npm : Depends: node-gyp (>= 3.6.2~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I did what was suggested, but it lead to another problem:
sudo apt install node-gyp
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:
node-gyp : Depends: libnode-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages
What did I miss?
If you face this issue in Ubuntu 20.04 do:
sudo apt install libssl1.1=1.1.1f-1ubuntu2
sudo apt install npm
Check this
For Ubuntu 18.x and 20.04, here's what does it:
sudo apt remove --purge nodejs npm
sudo apt clean
sudo apt autoclean
sudo apt install -f
sudo apt autoremove
sudo apt install curl
cd ~
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
node -v && npm -v
I ran into the same thing, when I tried to install nodejs
and npm
in a buster-based docker container.
It seems that now, you need to install yarn
which will take npm
along.
The solution was apt-get install nodejs yarn
.
Afterwards, the npm
command worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With