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 :)
Switching among Node. 7; we can simply run either nvm use 12.22. 7 or nvm use 16.13. 0 to easily switch into either version we need. Note that since we only have one version that begins with 12, 14, or 16, we can switch versions with a simple nvm use 16 , nvm use 14 , or nvm use 12 command.
Just type nvm alias default v10. 16.3 in your terminal and then type nvm use default . This command will make v10. 16.3 available in any shell you open — you just have to restart your terminal to make sure it works.
Yes, Sublime Text provides support for Node. js. So we can run nodejs app in Sublime Text.
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!
You can now add the following one-liner to your .bashrc
, .zshrc
, etc.
export NVM_SYMLINK_CURRENT=true
Then, anywhere you need your node path, it's always in the same place:
~/.nvm/current/bin/node #OR $HOME/.nvm/current/bin/node
Further reading: https://medium.com/@danielzen/using-nvm-with-webstorm-or-other-ide-d7d374a84eb1
you can use command "nvm which node-version " such as
nvm which 0.12.0
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