Skip to content

Instantly share code, notes, and snippets.

@joesepi
Forked from joaoneto/node_env.py
Last active May 26, 2022 07:22
Show Gist options
  • Save joesepi/11269417 to your computer and use it in GitHub Desktop.
Save joesepi/11269417 to your computer and use it in GitHub Desktop.
Updated python script to manage nvm and ST3 pathing for OSX
# Sublime package NVM node path configuration
# Save this file in:
# ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/node_env.py
import os
os.environ["PATH"] = "/Users/YOUR_USERNAME/.nvm/v0.10.26/bin:/Users/cranemes/.nvm/v0.10.26/lib:/Users/YOUR_USERNAME/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
print("PATH=" + os.environ["PATH"])
@brenthosie
Copy link

brenthosie commented Feb 7, 2017

epok75 I'm using oh-my-zsh and I think I have the right conversion but it isn't working for me still.

I put a node_env.sublime-build in /Users/{user}/Library/Application Support/Sublime Text 3/Packages/User with this in it:

{
    "shell_cmd": "zsh -c \"source ~/.nvm/nvm.sh && nvm run default $file\"",
    "selector": "source.js",
}

Sublime still tells me:

env: node: No such file or directory

Any ideas? The docs for zsh say:

 -c     Take the first argument as a command to execute, rather than reading commands from  a  script  or
              standard input.  If any further arguments are given, the first one is assigned to $0, rather than
              being used as a positional parameter.

looks similar to me how bash works.

@gblazex
Copy link

gblazex commented Jul 4, 2017

@davidhq worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment