How to Install NodeJS on Debian 9 Stretch Linux - LinuxConfig.org

NodeJS is on the rise, big time. It's one of the top web development tools, and when paired with the Express framework, it's solid direct competition to the likes of PHP and Ruby on Rails. Debian provides NodeJS in its repositories, but it's usually extremely out-of-date. There's no need to worry. The NodeJS Foundation recommends a Debian repository hosted by a popular NodeJS hosting service.
This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-install-nodejs-on-debian-9-stretch-linux

Dave Látal

I have installed nodejs build-essential libssl-dev and other but npm still doesnt work - bash: command npm not found … :frowning:

komorebi_e

Current Node LTS version is 8.9.3. The command in this article installs version 6.

Link to Nodejs.org installation instructions for Debian based distros.

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

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

pilotclan94

node -v
bash: node: command not found

what do i do???

impressionant santhosh

I tried installing with sudo:

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

But it threw an error:

## Confirming "stretch" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/...

## Adding the NodeSource signing key to your keyring...

 + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
 gpg: WARNING: nothing exported
 gpg: no valid OpenPGP data found.
 gpg: Total number processed: 0
 Error executing command, exiting

flojug

without sudo

$ curl -sL https://deb.nodesource.com/setup_6.x

shoud be

$ curl -sL https://deb.nodesource.com/setup_6.x > setup_6.x

and

# lsb_release -c -s

must return the distro name,

else

# apt-get install lsb-release