Setting up paths in Sublime with NVM


Question or issue on macOS:

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.

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 🙂

How to solve this problem?

Solution no. 1:

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:

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!

Solution no. 2:

you can use command “nvm which node-version ” such as

nvm which 0.12.0

Solution no. 3:

New Answer for 2020!

You can now add the following one-liner to your .bashrc, .zshrc, etc.


Then, anywhere you need your node path, it’s always in the same place:




Further reading:

Solution no. 4:


Solution no. 5:

Install NVM from

Run this command to install NVM as global and you’ll see everything works fine

wget -qO- | sudo bash

Solution no. 6:

I’m using n. I also tried nave but I was having trouble with it with nvm installed. Hope this helps.

Solution no. 7:

For Linux users,

By default nvm write some node paths in your .bashrc and there are loaded only if you’r in bash mode.

So just you need to move the two paths-line to the bottom on the file like that :

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# Set the NVM path for my Sublime before return.
export NVM_DIR="/home//.nvm"
[ -s "$NVM_DIR/" ] && . "$NVM_DIR/"  # This loads nvm

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

Solution no. 8:

I am using ubuntu 18 and this was how i was able to solve it

open your command prompt and access /home/{username}/.config/sublime-text-3/Packages create a new file and put this code

# $HOME/.config/sublime-text-3/Packages/

import os
import getpass

nvm_path = '/home/%(user)s/.nvm' % {'user': getpass.getuser()}
nvm_default_file_path = '%(root)s/alias/default' % {'root': nvm_path}
nvm_node_root = '%(root)s/versions/node' % {'root': nvm_path}

# Grab default alias
with open(nvm_default_file_path, 'r') as content_file:
   content =

# Prepend 'v' to match folder names
version = content.strip()
if version[0] != 'v':
version = 'v' + version

# Take highest valid folder name
versions = os.listdir(nvm_node_root)
found = sorted([v for v in versions if v.startswith(version)])[-1]

if found == None:
  print("Failed to configure node: no valid version found for %(version)s" %{'version': version})
  print("Configure node: %(version)s" % {'version': found})
  node_path = "%(root)s/%(version)s" % {'root': nvm_node_root, 'version': found }
  print("Node path: %(root)s" % {'root': node_path})
  path = "%(root)s/bin:%(root)s/lib:%(path)s" % {'root':node_path,'path':os.environ["PATH"]}
  os.environ["PATH"] = path

save this file as “”.

It helps solve issues with most JavaScript libraries like Typescript plugging and others.

Hope this helps!