[Pkg-javascript-devel] Untangling nodejs modules path resolution between system and user (advice needed)
Xavier
yadd at debian.org
Sat Oct 10 07:02:55 BST 2020
Le 09/10/2020 à 21:59, Jérémy Lal a écrit :
> Hi,
>
> i've now been using nodejs in debian for a while, deploying debian packages
> using nodejs, and also deploying user packages which do not want to fall
> back
> on system-installed modules (because of subtle discrepancies in the way
> they're crafted).
> Usually it goes well, but when it gets bad, it's really hard to debug
> that the cause
> of the issue comes from a system-installed node module, when you
> believed you
> have been using a local node_modules-installed package.
> That's why i really want to offer an explicit way of choosing how
> modules are
> resolved. I believe the nodejs package.json semantics are already enough to
> propose a straightforward and reliable default behavior.
> Something like:
> - when node script doing "require('thatmodule')" is run from /usr/share
> or /usr/lib*,
> only allow system-installed packages
> - when node script is run from elsewhere (and has a node_modules
> directory that is
> not the system path), stick to the standard upstream-designed
> node_modules resolution:
> never ever use system-installed modules. That doesn't forbid using them,
> it just requires
> an extra symlink if one really wants to.
>
> Please ±1
>
> Jérémy
Hi,
I think it will break our embedding system. For now, pkg-js-tools
automatically links debian/build_modules/* and all uscan components in
node_modules/. Then we mix all. Example: if an upstream rollup build
needs a missing rollup plugin, we put the missing plugin in
debian/build_modules/. Same with debian/tests/test_modules during test
phase.
Then I think your change must not affect default installation. Perhaps
could you add a parameter "mode = default/strict" in a /etc/nodejs.conf ?
Cheers,
Xavier
More information about the Pkg-javascript-devel
mailing list