Atom's node_modules directory on $NODE_PATH?


What are the chances of having /Applications/ automatically added to the NODE_PATH env var when Atom loads? I need to extend an included package, and the only way to do it right now seems to be by requiring a module from that package with an absolute path. It may work for now, but obviously, that’s bad for cross-platform compatibility.


They probably shouldn’t change the NODE_PATH since that could interfere with other Node installations, but they should make the built-in version of Node look there by default. I’m surprised to hear that they don’t, actually.


Couldn’t that be accomplished by setting $NODE_PATH just for the Atom process? Eg. if I run NODE_PATH=/Applications/$NODE_PATH atom that variable is only set for that specific process, so it shouldn’t interfere with any other node installations. Unless I’m misunderstanding something?


Oh yeah, good point :stuck_out_tongue: For some reason that didn’t register with me when I read your first post.

Though I’m still a little unsure about changing NODE_PATH. My vote is on handling this in-code, maybe by extending Module._initPaths. But changing the NODE_PATH for just the Atom process works equally well.

Also, how does one set an env var when launching an app graphically in OS X? And would there be a portable way to do that on all platforms?