How to solve “/usr/bin/env: ‘node’: No such file or directory” issue

Sometimes while working on any technology dependent on node, we get an error or issue /usr/bin/env:node : No such file or directory and we got stuck. So so in this artice we will see that how can we solve this node environment related issue.

For this first we will need to ensure that we have installed node correctly on our machine. If it is not correctly install then can follow the command below to install or reinstall.

Install nodejs8

curl -sL | sudo -E bash - sudo apt-get install -y nodejs

Install nodejs10

curl -sL | sudo -E bash - sudo apt-get install -y nodejs

Or, you can use directly  ubuntu apt command like below.

sudo apt install nodejs npm

But after installing the node js successfully on your machine and the issue didn’t resolve then the problem could be of naming.  When you install from a package manager your bin file may be called nodejs so you just need to symlink it using the command:

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

After applying the above solution, you will see that you have resolved the issue of /usr/bin/env:node: no such file or directory issue.