Using “node” to initialize scripts does not work while “nodejs” does

Using "node" to initialize scripts does not work while "nodejs" does

Problem

I followed installation instructions and successfully installed on a Ubuntu machine. But when I try to check the version with command node -v, it doesn’t return anything but when I enter nodejs -v it gives out the version. Ditto with the execution of scripts, if I give node hello.js nothing happens but when I give nodejs hello.js, the file executes.

I checked online on various websites and everywhere they are using node and not nodejs. I checked with a friend who has also installed from the same location and even for her its running with node and when she tries to give nodejs it says command not found. I also didnt find any documented issue regarding this. Any help is appreciated.

I just want to confirm is the below the reason for the problem?

There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You’ll need to symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.

Problem courtesy of: randomuser15995183

Solution

Yes, that is a known problem. You can read about that here, and the issue is also posted on GitHub.

From Debian.org in response:

The nodejs package shall be changed to provide /usr/bin/nodejs, not /usr/bin/node. The package shall declare a Breaks: relationship with any packages in Debian that reference /usr/bin/node.

Solution courtesy of: hexacyanide

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *