jonschlinkert / global-prefix

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

fails for custom set npm prefix #2

Closed tunnckoCore closed 8 years ago

tunnckoCore commented 8 years ago

Currently in my Arch i set it to /usr/local, because default installs of node and npm uses /usr. One way could be using require('rc')('npm').prefix (pretty faster and easier than spawnSync) and then fallback to process.execPath and DESTDIR

or if you want npm-prefix, but I don't like it that it does ../../ thing.

jonschlinkert commented 8 years ago

But that's not related this project is it? This provides the default paths used by npm.

Get the npm global path prefix. Same code used internally by npm

tunnckoCore commented 8 years ago

Hm. That's okey, but custom prefix again is global prefix, lol. It is lil' bit.. hm. To me it is logical when npm support custom prefix, this one also to support it and almost worth nothing. It would help for better resolving global modules, imo. I have few libs that depends on that module - get-installed-path, detect-installed and is-installed.

tunnckoCore commented 8 years ago

Also this package is used in global-modules which is with pretty clear description "the directory used by npm for globally installed npm modules."

jonschlinkert commented 8 years ago

so, should there be another lib called custom-prefix that uses a custom prefix if defined and falls back to global-prefix?

but custom prefix again is global prefix,

but, if I recall correctly that logic is handled by npm outside of the global prefix logic.

jonschlinkert commented 8 years ago

fwiw, I'm not necessarily opposed to adding logic for custom prefix. it depends on how much overhead it adds

tunnckoCore commented 8 years ago

another lib called custom-prefix

that's maybe the easiest way, but less meaningful and logical. maybe some other name at least, idk.

if I recall correctly that logic is handled by npm outside of the global prefix logic.

hm.. good point.

jonschlinkert commented 8 years ago

@tunnckoCore can you check and see if this works for you now?

tunnckoCore commented 8 years ago

I believe it worked before #8 or I may be wrong, but nevermind. I'll try asap, because i'm busy with university.

jonschlinkert commented 8 years ago

because i'm busy with university.

don't worry about this! university is much more important than this

jonschlinkert commented 8 years ago

Ok closing based on the assumption that it's working for you. If necessary we can reopen

tunnckoCore commented 8 years ago

Yep, works in first glance. :) Sorry for the delay.