Nodejs vs Node on Ubuntu 12.04
When installing Node.js on Ubuntu 12.04, you may encounter the issue where the node command doesn't exist in the terminal. This is due to a naming conflict with the Amateur Packet Radio Node Program, which has resulted in the Node.js binary being renamed to nodejs.
To resolve this issue, you need to create a symbolic link from /usr/bin/node to /usr/bin/nodejs. This can be done using the following command:
sudo ln -s `which nodejs` /usr/bin/node
Alternatively, if you use a non-standard shell, you can hardcode the path found with which nodejs:
sudo ln -s /usr/bin/nodejs /usr/bin/node
This will create the missing node symlink and allow you to use the Node.js commands with the node alias.
Additionally, if you use the zsh shell instead of bash, the node command should work without modification. However, if the issue persists, you can try the following additional solutions:
Install Node.js using alternatives:
sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
Purge and reinstall Node.js:
sudo apt-get --purge remove node sudo apt-get --purge remove nodejs sudo apt-get install nodejs
The above is the detailed content of Why doesn\'t the \'node\' command work after installing Node.js on Ubuntu 12.04?. For more information, please follow other related articles on the PHP Chinese website!