Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sublime Text 3: Apply NVM environment
# Save this file
# mac - "~/Library/Application Support/Sublime Text 3/Packages/"
# linux - "~/.config/sublime-text-3/Packages/"
# NOTE!
# ~/.nvm/alias/default must contain full version name.
# $ nvm alias default v4.3.5
import os
home = os.environ['HOME']
with open("%s/.nvm/alias/default" % home) as nvm_default_file:
nvm_default_contents = nvm_default_file.read().strip()
path = "%s/.nvm/versions/node/%s/bin" % (home, nvm_default_contents)
path = path + ":" + os.environ['PATH']
os.environ['PATH'] = path
@david-zacharias

This comment has been minimized.

Copy link

david-zacharias commented Jul 20, 2018

Thanks for the script. I had to change the script to match node folders on my system:

Additional v as prefix for node version folder in line 14:

path = "%s/.nvm/versions/node/v%s/bin" % (home, nvm_default_contents)
@oslyak

This comment has been minimized.

Copy link

oslyak commented Oct 8, 2018

Use
nvm alias default v10.11.0
Then nvm_default_contents will contain v char

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.