Limpuls
Limpuls

Reputation: 876

Node conflict: Nodejs -v works, but not node -v

So, I'm trying to install node.js on my raspberry pi 3 which is running on Raspbian OS. When I first picked it up, I installed node.js 8.9.0 following some tutorials, but for some reason I already had node installed before and when I would run nodejs -v I would get 8.9.0 version back but if I run node -v I would get version 4.3.2. So there was some version conflict. I tried to uninstall both, but after uninstalling both and typing node -v I would still get version 4.3.2. So by following some tuts, I also deleted node_modules from /usr/local/lib and all the other dir's. Then I installed nodejs again and finally when I run nodejs -v I get 8.9.0 version, but node -v command doesn't work at all. I get -bash: /usr/local/bin/node: No such file or directory error to the Terminal.

So what's the problem and how can I fix it? How can it be that nodeJS is working but not node? I created a simple server file and tried to run it using node command and it doesn't work because of this. Bear in mind that I'm totally linux newbie so command line and file structure is foreign to me.

Upvotes: 1

Views: 457

Answers (1)

Kalana Demel
Kalana Demel

Reputation: 3266

Try creating a symlink between the two using.

sudo ln -s `which nodejs` /usr/bin/node

Upvotes: 2

Related Questions