Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node: command not found on Debian

Tags:

node.js

debian

So, I'm working on a mac and as webserver, I got Debian 8 installed. However, I'm currently working on a node application which I developed on my localhost most of the time, where everything works fine - I can use node index.js without issues.

However, I installed node on my webserver via the recommendation of the node.js website, which is ...

sudo apt-get install -y nodejs

... which didn't throw any errors. After that, I could use the npm command. But when I try to execute node index.js, I receive bash: node: command not found. Also, node is not installed in my /usr/local/bin folder. So I can't even run in via /usr/local/bin/node which was recommended here.

So what exactly did I do wrong? I'm rather confused right now and really don't know how to fix the problem.

like image 429
Realitätsverlust Avatar asked Apr 27 '16 07:04

Realitätsverlust


1 Answers

Did you previously install node package, too? If so, try:

$ sudo apt-get --purge remove node
$ sudo apt-get --purge remove nodejs
$ sudo apt-get install -y nodejs-legacy

# check
$ node --version
v4.0.0

See also this answer

like image 166
MarcoS Avatar answered Oct 04 '22 19:10

MarcoS