2
I'm using Fish shell/omf, NVM (https://github.com/derekstavis/plugin-nvm), and Sublime Text 3. I'm trying to use a build system to run nodemon
(which I installed with npm -g install nodemon
). nodemon
works fine from within a native Fish shell:
~ » nodemon 15:47:56
Usage: nodemon [nodemon options] [script.js] [args]
See "nodemon --help" for more.
If I run which nodemon
, I get:
~ » which nodemon 15:48:05
/Users/me/.nvm/versions/node/v7.5.0/bin/nodemon
(expected, from what I understand).
The problem:
Sublime doesn't seem to recognize the NVM path. Take this build system:
{
"shell": true,
"cmd": ["nodemon '$file'"],
"selector":"source.js"
}
/bin/sh: nodemon: command not found
[Finished in 0.0s with exit code 127]
[cmd: ["nodemon '/Users/me/Dev/tmp/nodemon-test.js'"]]
[dir: /Users/brandon/Dev/tmp]
[path: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin]
I see that the path variable for Sublime doesn't have the NVM search path:
~ » echo $PATH 15:48:20
/Users/me/.nvm/versions/node/v7.5.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin
What's the correct way to fix this to make Sublime's $PATH match Terminal's $PATH? I'd expect it to continue to work even when I switch Node versions with NVM too.
Edit:
Yes, I'm using the omf solution for NVM, which works because I can run both nodemon
and node
from Terminal directly.
Yes to your second point, but as for the path option, that means that each time I change node version I'm going to have to manually update that in the build system right? Unless NVM has some alias somewhere for "current version"? – brandonscript – 2017-02-26T18:08:39.507