[Pkg-javascript-devel] Bug#823597: npm: If npm is updated with npm install npm -g, /usr/share/npm/npmrc is lost

Jérémy Lal kapouer at melix.org
Fri May 6 10:58:56 UTC 2016


Package: npm
Version: 1.4.21+ds-3
Severity: normal
Tags: upstream

Got hit again by
https://github.com/npm/npm/issues/533

I'm sharing it here so other users can find a workaround.

`npm install npm -g` will correctly install latest version of npm in
/usr/local (provided current user is member of staff group).

Unfortunately, /usr/local/bin/npm will look for npmrc in the following places:
/usr/etc/npmrc, /usr/local/lib/node_modules/npm/npmrc...
but where we'd like it to look for:
/etc/npmrc
/usr/local/etc/npmrc
/usr/share/npm/npmrc (this is the one from the debian package)

It is a problem because *npm loses its /usr/local prefix*, so future
`npm install -g xxx`
will try to install into /usr/lib.

Workaround: after `npm install npm -g`, copy or symlink /usr/share/npm/npmrc to
/usr/local/lib/node_modules/npm/npmrc.

Jérémy.



More information about the Pkg-javascript-devel mailing list