Having problem with installing npm in ubuntu 16.04.3
Solution 1
After facing numerous errors, finally get success to resolve the issues. Here are the steps I followed.
First I installed "curl" by following http://sourcedigit.com/20782-install-curl-ubuntu-via-command-line/ . This article provides two ways to install curl and I successfully installed curl using "Alternate Method To Install Curl".
Then I executed commands in sequence
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
By executing above nodejs command, node js version 8 is installed with npm version 5.3.0
Solution 2
add python libraries for that:
sudo apt-get install python-software-properties
add the ppa for latest nodejs with this command :
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
then try :
sudo apt install -y nodejs
I hope this will work for you, because this works for me.
Related videos on Youtube
![sadia](https://i.stack.imgur.com/sIx3a.jpg?s=256&g=1)
sadia
I am a systematic, organized, hardworking, and dedicated team player having an experience of 8 years with an analytical bent of mind. My work is my passion and I have often indulged deep to achieve my goals stretching to the point of risk. I strongly believe in pushing for challenging limits at the work front and I would love to be a part of an organization that provides me scope to do so.
Updated on September 18, 2022Comments
-
sadia almost 2 years
After installing node.js I execute this command:
sudo apt-get install npm
And getting error:
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.
$ sudo apt-get upgrade -f npm node-gyp Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... 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: nodejs-dev : Depends: libssl-dev (>= 1.0.0g) but it is not going to be installed E: Broken packages
-
Scott Stensland over 6 yearsnpm comes bundled together with an install of nodejs ... never a need to do a separate npm install
-
David Foerster over 6 yearsCould you please edit your question to include the full, verbatim output of
sudo apt-get upgrade -f npm node-gyp
? Thanks. -
sadia over 6 years@DavidFoerster I added output of the command in Question, please see
-
David Foerster over 6 yearsThank. Let's go further! What's the output of
sudo apt-get upgrade -f libssl-dev
? -
sadia over 6 years@DavidFoerster issue is solved, I put my solution as an answer in this thread. Thanks :)
-
-
sadia over 6 yearsnodejs already installed in my system, however i am facing issue with npm
-
Deki Akbar over 6 yearsit will install nodejs and npm... did you try it??
-
sadia over 6 yearsfirst command is successfully executed but on second command getting curl error program is not found. but when i tried to install curl again get dependency error "The following packages have unmet dependencies: curl : Depends: libcurl3-gnutls (= 7.47.0-1ubuntu2) but 7.47.0-1ubuntu2.2 is to be installed"
-
Scott Stensland over 6 yearsissue sudo apt-get install build-essential curl then re-do above steps in this answer
-
Deki Akbar over 6 yearsyou can install curl using this tutorial codebind.com/linux-tutorials/install-curl-ubuntu-16-04