I agree, this is a bit of an issue but I don't know why it's happening.
The Fix
First things first, just create a symbolic link from called node
pointing to the nodejs
binary.
ln -s /usr/bin/nodejs /usr/bin/node
The Problem
Quite a few guides I found for installing Nodejs (here and here) all have similar code to test whether the installation happened correctly. So essentially create a simple server like so:
// hello_node.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
and then run it in nodejs with the following:
node hello_node.js
And then when I was trying to use npm to install something, it was failing and reporting the same node not found
message.
nodejs
is in the PATH, butnode
andnpm
aren't available, I can't find them anywhere on my system. – Matthieu Napoli Jan 13 '14 at 17:53node
binary was renamed was because it conflicted with one of the packages callednode
(Amateur Packet Radio Node Program). – Yong Jie Wong Jan 13 '14 at 21:16node
and notnodejs
?node
is not what you think it is. – Braiam Jan 13 '14 at 22:49node
is used in every tutorial I've seen – Matthieu Napoli Jan 14 '14 at 08:45node
package in Ubuntu will be renamed toax25-node
. So hopefully in the future Ubuntu will just install a binary namednode
when you installnodejs
. @Braiam The de-facto standard shebang for node.js scripts is#!/usr/bin/env node
, so Ubuntu sort of breaks standard node.js scripts because of its binary name conflict policy which was not respected by the node.js project. – binki May 08 '17 at 18:44