[Pkg-javascript-devel] Untangling nodejs modules path resolution between system and user (advice needed)
Jérémy Lal
kapouer at melix.org
Fri Oct 9 20:59:36 BST 2020
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20201009/d276a689/attachment.html>
More information about the Pkg-javascript-devel
mailing list