jonschlinkert / global-prefix

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

Traverse all npm config (npmrc) files to find global prefix #8

Closed mathiasvr closed 8 years ago

mathiasvr commented 8 years ago

Hi, I made some changes to fix #3, it is not pretty though! 😄

It is a very big change, but should reflect how npm currently gets the global prefix. I kept the code synchronous, but an asynchronous version would probably be better for this.

I don't think there is a way around all the IO. In my case i installed node using homebrew and the module would give me the global prefix as /usr/local/Cellar/node/6.2.0 because of process.execPath, but it was by default being set to /usr/local in the builtin npmrc.

jonschlinkert commented 8 years ago

I don't think there is a way around all the IO.

I think you're right, this just confirms what I ran into when trying to fix this myself!

it looks good I'll try to pull it down tomorrow and merge asap. thanks!