3

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?

2 Answers 2

4

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 update && apt-get install -y nodejs 
2
  • 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. Commented Jan 26, 2019 at 23:09
  • Don't forget "apt-get update" before install Commented Jun 12 at 9:29
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"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.