I've installed on a XUbuntu 13.10 the software Node.js through package manager:
xxx@xxx:/$ sudo apt-get install nodejs
All seems good but along with nodejs executable I've found a js executable.
Both, if called with -v option, show v0.10.15 and I've successfully used both of them as a Javascript interpreter.
My question is: is there any difference between nodejs command and js command? Is js just an alias for the nodejs command?
It has to do with /etc/alternatives, the Ubuntu/Debian alternatives mechanism.
/usr/bin/js — is a link to/etc/alternatives/js — is a link to/usr/bin/nodeThus if you've got /usr/bin in your PATH, running js is effectively exactly the same as running node (except that two symlinks have to be traversed, which is not a significant cost). Using js in scripts (for example) would allow the system to be configured to use an alternative to the installed Node version — maybe a different version, or a version built with some experimental feature.
You can read more about it in the update-alternatives man page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With