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?

freginold
  • 239
  • 1
  • 7
Lajdák Marek
  • 147
  • 1
  • 2
  • 7

2 Answers2

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
Andrew
  • 2,057
  • 2
  • 16
  • 25
  • 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 '19 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"

Ramast
  • 171
  • 1
  • 3