Installing Atom on a system with Node installed via NVM
I was interested in trying out Github’s new editor Atom on my Linux Mint box. It’s not included in the official Mint PPAs, so I decided to build it from the source using the build instructions provided in the Atom repo. The build went well, but the actual installation step failed with the error:
$ /usr/bin/env: node: No such file or directory.
It turns out that this is because I’ve installed node using NVM rather than installing one of the node packages. I did some research and only found workarounds that involved permanently creating junctions or other long lasting changes. Luckily, I came up with a little workaround.
First, I launched a new bash session from the existing terminal with:
$ sudo bash
Then, I used the source command to execute the nvm.sh file in that session:
$ source /home/myusername/.nvm/nvm.sh
At that point I was able to run the install script (without specifying sudo, since I was in a root bash session):
$ ./script/grunt install
Of course, this requires me to run the source command any time I need to run node with sudo, but that should be a pretty rare occasion.
Let me say that I am a complete Linux noob, so YMMV. But, it worked for me.