4

I did on Debian testing sudo apt install nodejs but I'm missing npm.

$ node -v
v8.11.2
$ npm -v
bash: npm: command not found

What did I miss?

slm
  • 363,520
  • 117
  • 767
  • 871
user3523406
  • 323
  • 2
  • 9
  • 15
  • should I do [this](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)? – user3523406 May 22 '18 at 01:37

2 Answers2

2

npm turned out to involve too much work to maintain properly (with security support etc.) in Debian 9, given the current level of maintainer involvement, so it was removed from the release and isn’t available from the “stable” Debian repositories.

To install NPM you should follow the upstream instructions, which will configure your system to use their repository:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

This will install Node.js 8.x; if you need 10.x you can replace the “8” above with “10”.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • pnpm sound actually good ` curl -L https://unpkg.com/@pnpm/self-installer | sudo node` – user3523406 May 23 '18 at 06:04
  • 1
    hm, this will still install the -dfsg debian version without npm :-( – dothebart Aug 24 '18 at 12:15
  • 1
    @dothebart I just checked, and on a default Debian setup, the instructions above install the Node.js-hosted version with `npm` (`apt policy` shows it as the candidate version). You might want to ask a new question explaining your problem: describe the steps you followed to try to install `nodejs`, and most importantly, include the output of `apt policy nodejs`. – Stephen Kitt Aug 24 '18 at 12:31
  • my problem was that the script will terminate if there are apt-errors from other repos, and thus the nodesource repo wasn't added in first place. – dothebart Aug 27 '18 at 11:25
0

To Install NodeJS execute following three steps

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
Chandani Patel
  • 208
  • 3
  • 9