run npm command gives error “/usr/bin/env: node: No such file or directory”

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

Grunt “Command Not Found” Error in Terminal

$ RUN npm install -g grunt-cli

Install Yarn

Remove mistake packages:

sudo apt-get purge cmdtest
sudo apt-get purge yarn

Install with npm (Recommended way):

It is recommended to install Yarn through the npm package manager, which comes bundled with Node.js when you install it on your system.

Once you have npm installed you can run the following both to install and upgrade Yarn:

npm install --global yarn

Alternative way (Debian / Ubuntu):

curl -sS | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install yarn

Upgrade Node

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo n latest

ِYarn error

Error: error:0308010C:digital envelope routines::unsupported

Fixed by:

$ export NODE_OPTIONS=--openssl-legacy-provider
$ yarn start

ِYarn change default port

$ export PORT=3001