Setting up paths in Sublime with NVM

tusharmath picture tusharmath · Apr 18, 2014 · Viewed 11.1k times · Source

I am using NVM as my node version manager on OSX, which is great except that it creates multiple problems with my IDE. I am using Sublime Text and most of the plugins that I have ever used look for nodejs at /usr/local/bin and since I am using NVM node is obviously not available at that location, instead available at /Users/${User}/.nvm/${NodeVersion}/bin/node.

I have an option of updating the path of nodejs in that plugin's configuration but then when I install another plugin I have to do the same thing. Same applies to using CoffeeScript, LESScss etc.

Moreover when I update my node version via NVM, I have to update the paths in all the configs again. NVM has quite essentially created more problems while trying to solve one for me.

UPDATE: After a very long time I was able to finally resolve the problem using isaacs brilliant solution - nave. The nave usemain stable command, is just enough to understand you sentiments :)

Answer

joe sepi picture joe sepi · Apr 25, 2014

I was having a similar problem yesterday. I found a python script that exports my Node path (the nvm node path) for Sublime. I updated it for OSX and ST3. You can find it here: https://gist.github.com/joesepi/11269417

Drop that script in your Packages dir, the path for ST3 is in the comments in the script. You may have to restart ST as well. And if you update your node version, you will need to update that script too. I hope that helps!