2

Can somebody please help with installing NPM in Debian?

First I tried apt-get install npm but got this message:

Unable to locate package npm.

So I followed the installation steps for Debian from nodejs.org. The first command:

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -

gave this message:

sudo command not found.

But if I install packages do not have to write sudo so I deleted it and got this message:

-E command not found

Any hints?

3

If you don't have sudo installed, then your command string should be this instead:

curl -sL https://deb.nodesource.com/setup_9.x | bash -
apt-get install -y nodejs
  • 1
    That didn't work out of the box because debian still wanted to install the old version of nodejs not the one from the repo. I fixed that by forcing debian to install latest version of nodejs 1. – Ramast Jan 26 at 23:09
1

Andrew's answer was really helpful but didn't work out of the box because debian still wanted to install the old version of nodejs not the one from the repo.

I fixed that by forcing debian to install latest version of nodejs

I ran apt-cache policy nodejs to know the version of latest nodejs package Then once I figured that out I ran apt install "nodejs=<latest_version>" at the time of writing it was apt install "nodejs=9.11.2-1nodesource1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.