Select Page

The name of the NodeJS interpreter ( node) on Ubuntu has been renamed nodejsdue to the name conflict with another package. Here’s what readme.debian says:

The upstream name for the Node.js interpreter command is “node”. In Debian the interpreter command has been changed to “nodejs”.

This was done to prevent a collision in the namespace: other commands use the same name in their upstream, as ax25-node from the “node” package.

Scripts that call Node.js as a shell command must be modified to use the “nodejs” command instead.

However, the use of nodejs requires the installation of packages using npm. The installation of the package fails with the following error:

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary “node”
npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian
How do I understand that npm is already installed on the system, but is the interpreter’s name different?

Solution

Try to connect the node to nodejs. First find out where nodejs is located

whereis nodejs

Then the node of the software link to nodejs

ln -s [the path of nodejs] /usr/bin/node 

I’m assuming that / usr / bin is in your execution path. So you can test by typing node or npm in the command line, and everything should work now.

 

WhatsApp chat