jussi-kalliokoski / atom-npm-plus

npm integration for atom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm may not be on the path.

jsg2021 opened this issue · comments

I use nvm to manage my npm/node versions. I do not have a system wide npm/node available, my .profile/.bashrc has to be sourced for my npm to be on the path.

If i launch atom from the terminal, all is fine. But not if I launch atom from Mac's dock, or a launcher (ie: gnome-do, launchbar, alfredapp, quicksilver, etc)... because those processes don't originate from a process that had my .profile env vars set up.

All that to say, there should probably be a setting to allow the user to specify the npm path. Or bonus points if you can get the child process to execute in a sub-shell and let it pick up the env setup from the users' .profile ;)

Sorry I haven't had time to look at this until now.

Yes, this is a pain point for myself as well. However, the bigger issue is that the problem is not solved by just allowing the user to specify the npm path because most of the npm scripts depend on node as well, and unfortunately many also depend on globally installed commands. Importing the $PATH from .profile would be tempting but then again not that many people even define their env variables there (including myself, since I'm using fish :). Spawning a subshell was something I initially considered, but again, people are using various different shells and we need to be compatible with Windows too.

Currently most atom plugins seem to be solving the issue with allowing the user to configure the path to the executables, so it ends up being boilerplate in all of them. I think a more elegant solution would be a PATH provider package for Atom, where you could list paths to include before and after the inherited paths. That would allow packages to just spawn say node or npm without worrying about where they're located and the user would have a centralized location to define their (additional) binary paths.