How to fix the error / usr / bin / env: "node": No file or directory

Sometimes when we try to run an application that uses nodejs in Debian, Ubuntu and derivatives, it throws us the following message error /usr/bin/env: «node»: No existe el archivo o el directorio and the application does not run, it is a problem known for a long time that can be solved in a very simple way, the steps to solve it and the reason for the error are described below.

About / usr / bin / env error: "node": File or directory does not exist

El error /usr/bin/env: «node»: No existe el archivo o el directorio has been known for quite some time, its origin dates back to LinuxNode (package node) and node.js (package nodejs) have been designed to be called from the command node and they conflict at the time of their execution.

The Debian Technical Committee for Preventing Program Name Collisions in the Distribution, decided that the package nodejs will no longer be called from the command node  but from nodejs and that a binary called nodejs-legacy (that contains a /usr/bin/node as a symbolic link to /usr/bin/nodejs).

Due to conflicts of concepts, sometimes this type of errors is still maintained, the solution to the problem is quite simple.

The solution to the error / usr / bin / env: "node": The file or directory does not exist

The proper way of this error is by installing the binary nodejs-legacy that contains the symbolic link and that solves eliminates the incorrect call automatically, the command to perform it is the following:

sudo apt-get install nodejs-legacy

The alternative to installing the corresponding binary package is that we create a symbolic link to access node, the command to execute would be the following:

ln -s /usr/bin/nodejs /usr/bin/node

With any of these commands you can solve this problem, which is simply caused by an ambiguity when calling the corresponding packages and which should already be solved.


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Jahir Gilberth Medina Lopez said

    Thank you very much, the gtop had been giving me problems