[Pkg-javascript-devel] npm debian package

Isaac Schlueter i at izs.me
Thu Oct 6 23:06:00 UTC 2011


So, then, as a change to npm, you're suggesting that if the `--prefix`
setting is `/usr`, then it should look for the globalconfig file as
/etc/npmrc, and the globalignore file as /etc/npmignore.

Then, you'll put a file at /etc/npmrc to override that prefix, so that
it's actually putting things in /usr/local instead of /usr.

I'm not sure how I feel about putting in some special case for when
prefix==/usr.  It's inelegant, to say the least.  Special-casing based
on the location of the npm executable is even worse.

Also, if you actually install npm into prefix=/usr, but then configure
it to operate on prefix=/usr/local, then `npm install npm -g` will
result in two copies of npm installed, which is confusing to users.

It would be better, in my opinion, to install npm into a prefix of
/usr/local, and then symlink the /usr/local/bin/npm to /usr/bin/npm,
and symlink /usr/local/etc/{npmrc,npmignore} into /etc.

On Thu, Oct 6, 2011 at 14:18, Jérémy Lal <jerry at edagames.com> wrote:
> Thank you for your answers,
> here is what i propose that would fit :
>
>
> On 06/10/2011 19:28, Isaac Schlueter wrote:
>> Patching node won't do the trick.  npm finds the real actual location
>> of the node executable in the path using the `node-which` library.
>> This is to prevent installing into some buried place like
>> /usr/local/Cellar/node/0.4.12/exec/lib/node_modules when node is
>> symlinked out of there to /usr/local/bin/node.
>
> ok.
> patching node just to fix this was a bad idea anyway.
>
>
>> I'd definitely recommend configuring npm to live someplace where you
>> can allow it to have full reign over the global install space.  It
>> won't ever do anything outside its global "prefix" config (or the
>> local package for non-global installs).
>> It appears that this is the set of constraints:
>>
>> 1. global config *must* be /etc/npmrc
>> 2. `which npm` *must* be /usr/local/bin/npm
> The debian package must distribute npm executable in /usr/bin/npm,
> or else it won't be accepted. That does not prevent npm from reigning
> over /usr/local/{bin,lib/node_modules,share/man}
>
>> 3. npm source *must not* be patched in any dramatic manner
>> 4. npm global installs *must* still work, but *must not* write
>> directly in /usr/local/{bin,lib/node_modules,share/man}
> That's not what i meant at all.
> npm-g can do whatever it wants to /usr/local/*
> Anyway please read below.
>
>> I would much rather use npm's extensive configuration options to
>> accomplish this, and not make any changes to the source itself.  If
>> there's some reason you can't do this with the ~/.npmrc or the
>> <prefix>/etc/npmrc files, then let's talk about what npm needs to
>> change to support this use case.
>
> Here's what i propose for a minimal change to npm, that makes it possible to
> be installed and used 100% as intended :
>
> if `which npm` is /usr/bin/npm, let npm find /etc/npmrc as the global config;
> instead of /usr/etc/npmrc, which is a non-standard place to put a config file.
> Same goes for /usr/etc/npmignore, but having /etc/npmrc is enough : the npm
> debian package will distribute /usr/bin/npm along with /etc/npmrc containing at least
> prefix=/usr/local
> globalignorefile=/etc/npmignore
>
> It would be fantastic we could agree upon that.
>
> Jérémy.
>
>



More information about the Pkg-javascript-devel mailing list