jonschlinkert / global-prefix

Get the npm global path prefix. Same code used internally by npm.
MIT License
28 stars 12 forks source link

does not work inside Atom (packages) #19

Open JaninaWibker opened 7 years ago

JaninaWibker commented 7 years ago

When using inside Atom (or probably any electron app) the returned path is incorrect if the fallback is used since process.execPath is not the node executable but instead the electron app:

$ process.execPath
/Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper
jonschlinkert commented 7 years ago

want to do a pr?

JaninaWibker commented 7 years ago

Wouldn't know how to fix this. Just trying to avoid falling back to the fallback function (as a user of this package) could work (I just set the PREFIX ENV variable).

jonschlinkert commented 7 years ago

Ok, no prob. I'll look into it more, I believe I saw a solution to this at some point. If someone else notices this issue and has ideas, I would greatly appreciate if you shared them or did a pr. thanks

kachkaev commented 5 years ago

I confirm that the problem still exists. It is presenting itself in prettier-atom: https://github.com/prettier/prettier-atom/issues/448

When global modules are installed via NVM, global-modules (which relies on global-prefix) returns null.