[Pkg-javascript-devel] Bug#872433: [with solution] Doesn't find modules installed in Debian directories

Julien Puydt julien.puydt at laposte.net
Thu Aug 17 11:40:19 UTC 2017


Package: node-resolve
Version: 1.1.7-2
Severity: grave

Hi,

I'm surprised nobody reported it yet since it basically makes the
package useless as far as I see, but the current node resolve doesn't
find modules installed in Debian directories : while working on another
package, I was surprised that nothing was found. When investigating
using strace, I saw that resolve.sync was always adding "node_modules"
to the paths it tried, so of course it didn't find anything.

I got things to work by editing node-modules-paths.js from:

module.exports = function nodeModulesPaths(start, opts) {
    var modules = opts && opts.moduleDirectory
        ? [].concat(opts.moduleDirectory)
        : ['node_modules'];

to:

module.exports = function nodeModulesPaths(start, opts) {
    var modules = opts && opts.moduleDirectory
        ? [].concat(opts.moduleDirectory)
        : ['node_modules', ''];

ie: I added '' to the list of things to add when generating paths to check.

The following two lines fail with the unpatched node-resolve, and work
with the patched one:
    resolve=require('resolve')
    resolve.sync('resolve/lib/core.js', {basedir: '/usr/lib/nodejs'})
(it should be added in debian/tests/)

I'm part of the Debian Javascript maintainers team so I can add the
necessary patch (with the right header) and test [and probably push
higher upstream version, std-ver and dh] to the git repository to help
if you want -- but I'm no DD so can't upload myself.

Cheers,

Snark on #debian-js



More information about the Pkg-javascript-devel mailing list