Closed Bug 1716257 Opened 3 years ago Closed 3 years ago

`mach npm` executes npm with the node from PATH, sometimes causing node-gyp module builds to fail

Categories

(Firefox Build System :: General, defect, P1)

defect

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: dmosedale, Assigned: dmosedale)

References

Details

Attachments

(1 file)

To make activity-stream fail to install its dependencies, ensure that from your shell, node --version show Node 16 on Mac OS X 64 on Intel, and do this:

rm -fr browser/components/newtab/node_modules && ~/.mozbuild/node/bin/npm install --prefix browser/components/newtab

It will blow up, and the error messages will make it clear that it was using Node 16 from the PATH, rather than the version of node in ~/.mozbuild/node/bin

Strictly speaking, I don't think this blocks bug 1690377 from landing, but I think it'd be awfully good to get this landed around the same time.

What's going on:

npm currently is executed by the OS with:

#!/usr/bin/env node

which means it just uses the node in the current PATH.

Julien, I'd be interested to hear if this patch solves the problem you've been having with PATH stuff, or if wants its own bug...

Flags: needinfo?(felash)
Attachment #9226736 - Attachment description: Bug 1716257 - make `mach npm` use the same version of node, r?glandium!,Mardak! → Bug 1716257 - make `mach npm` use the same version of node, r?mhentges!,Mardak!
Pushed by dmosedale@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9c3b77bb3032 make `mach npm` use the same version of node, r=mhentges
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch

The problem I see is when building the debugger source code, the lines I see in the output look like this:

0:30.42 Executing "/usr/bin/nodejs /home/julien/travail/git/mozilla-central-artifacts/devtools/client/shared/build/build.js /home/julien/travail/git/mozilla-central-artifacts/devtools/client/debugger/src/main.js /home/julien/travail/git/mozilla-central-artifacts/devtools/client/debugger/src/vendors.js /home/julien/travail/git/mozilla-central-artifacts/obj-x86_64-pc-linux-gnu-opt-artifact/dist/bin/browser/chrome/devtools/modules/devtools/client/debugger/src"

In the configure part of the build, I get:

 0:02.06 checking for nodejs... /usr/bin/nodejs (10.24.0)

I'm especially surprised because I see that ./mach bootstrap downloads a node installation (currently v10):

 0:02.82 Setting up artifact node.tar.zst
 0:02.82 Using artifact from local cache: /home/julien/.mozbuild/toolchains/6aef59b6410bef2e-node.tar.zst
 0:02.88 rm tree: /home/julien/.mozbuild/node
 0:03.06 untarring "/home/julien/.mozbuild/node.tar.zst"

(in this case it reused a previously downloaded version)

So why don't we use that one?

I still see the same thing after this patch.

Flags: needinfo?(felash)

(In reply to Julien Wajsberg [:julienw] from comment #5)

The problem I see is when building the debugger source code, the lines I see in the output look like this:

0:30.42 Executing "/usr/bin/nodejs /home/julien/travail/git/mozilla-central-artifacts/devtools/client/shared/build/build.js /home/julien/travail/git/mozilla-central-artifacts/devtools/client/debugger/src/main.js /home/julien/travail/git/mozilla-central-artifacts/devtools/client/debugger/src/vendors.js /home/julien/travail/git/mozilla-central-artifacts/obj-x86_64-pc-linux-gnu-opt-artifact/dist/bin/browser/chrome/devtools/modules/devtools/client/debugger/src"

In the configure part of the build, I get:

 0:02.06 checking for nodejs... /usr/bin/nodejs (10.24.0)

I'm especially surprised because I see that ./mach bootstrap downloads a node installation (currently v10):

 0:02.82 Setting up artifact node.tar.zst
 0:02.82 Using artifact from local cache: /home/julien/.mozbuild/toolchains/6aef59b6410bef2e-node.tar.zst
 0:02.88 rm tree: /home/julien/.mozbuild/node
 0:03.06 untarring "/home/julien/.mozbuild/node.tar.zst"

(in this case it reused a previously downloaded version)

So why don't we use that one?

I still see the same thing after this patch.

You're building with --enable-release, aren't you?

You're building with --enable-release, aren't you?

I'm not :-)

I filed Bug 1716600 about my issue (I should have noticed earlier), Dan looked at it yesterday and concluded this wasn't a big problem, as we're taking the system's nodejs only if it satisfies the version requirement.
I guess we could still see the same issue as this one if the system's node is too recent... but that shouldn't happen on a Debian installation :-D

See Also: → 1785742
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: