jonschlinkert / global-prefix

Get the npm global path prefix. Same code used internally by npm.
MIT License
28 stars 12 forks source link

test failing on debian build environment #15

Closed pravi closed 7 years ago

pravi commented 7 years ago
mocha -R spec

  prefix
    1) should resolve the path to the global prefix:

  0 passing (18ms)
  1 failing

  1) prefix should resolve the path to the global prefix::

      AssertionError: '/usr/local' == '/usr'
      + expected - actual

      -/usr/local
      +/usr

      at Context.<anonymous> (/<<PKGBUILDDIR>>/test.js:26:16)
      at callFn (/usr/lib/nodejs/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/usr/lib/nodejs/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/usr/lib/nodejs/mocha/lib/runner.js:373:10)
      at /usr/lib/nodejs/mocha/lib/runner.js:451:12
      at next (/usr/lib/nodejs/mocha/lib/runner.js:298:14)
      at /usr/lib/nodejs/mocha/lib/runner.js:308:7
      at next (/usr/lib/nodejs/mocha/lib/runner.js:246:23)
      at Immediate._onImmediate (/usr/lib/nodejs/mocha/lib/runner.js:275:5)
      at processImmediate [as _immediateCallback] (timers.js:383:17)

Debian's nodejs has this patch https://anonscm.debian.org/cgit/collab-maint/nodejs.git/tree/debian/patches/2001_FHS_and_rename_to_nodejs.patch which I suspect is making the default to /usr. How can we handle this case?

--- a/lib/module.js
+++ b/lib/module.js
@@ -616,7 +616,7 @@
     homeDir = process.env.HOME;
   }

-  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
+  var paths = ['/usr/lib/nodejs'];

   if (homeDir) {
     paths.unshift(path.resolve(homeDir, '.node_libraries'));
doowb commented 7 years ago

Hi @pravi will you try this PR on debian? That PR is passing in ubuntu and may work on debian but I don't have access to debian to test it.

I'm not familiar with how debian handles node.js. Are you linking to code that patches node.js when the node.js is built (installed and built?) in debian?

pravi commented 7 years ago

@doowb , thanks, the tests are passing now.

These patches -> https://anonscm.debian.org/cgit/collab-maint/nodejs.git/tree/debian/patches are applied to nodejs during build. Ubuntu usually takes the same packages from debian (only version numbers differ due to difference in release cycles).

doowb commented 7 years ago

the tests are passing now.

Thanks for running them. We'll try to get that PR merged and published soon.

doowb commented 7 years ago

Merged the PR and published as 0.1.5. Let us know if you're still having issues.