Closed Bug 1509387 Opened 3 years ago Closed 3 years ago
./mach lint -l eslint doesn't look for node in ~/.mozbuild
Bug 1509387 - When setting up ESLint, call npm via node so that node doesn't need to be in the path.
47 bytes, text/x-phabricator-request
|Details | Review|
I tried to run `./mach lint -l eslint`. It failed because it couldn't find node, and told me to run `./mach bootstrap --no-system-changes`. So I ran that, which downloaded a new clang, cbindgen, and node into my ~/.mozbuild. Then I ran `./mach lint -l eslint` again, and again it failed with the same thing. After I ran `PATH=$PATH:$HOME/.mozbuild/node/bin` it worked. Seems to me like the mach command should look in .mozbuild for node.
(This was on Ubuntu 16.04, in case it matters)
This should be getting the mozbuild directory from: https://searchfox.org/mozilla-central/rev/876022232b15425bb9efde189caf747823b39567/python/mozboot/mozboot/util.py#10 Which is called from: https://searchfox.org/mozilla-central/rev/876022232b15425bb9efde189caf747823b39567/python/mozbuild/mozbuild/nodeutil.py#108 https://searchfox.org/mozilla-central/rev/876022232b15425bb9efde189caf747823b39567/python/mozbuild/mozbuild/nodeutil.py#21 Could you try tracing it through and see if you can see what's going wrong?
Those bits seem to work ok. The problem is that found_exe ends up pointing to the npm binary at /home/kats/.mozbuild/node/bin/npm, and the very first line of that is "#!/usr/bin/env node". So when we run said npm binary to check the version, it fails to run because there's no `node` binary on the PATH and /usr/bin/env won't find it.
Here's what I see at the top of the output with a printout that I added: $ ./mach lint -l eslint gfx/wr/ found_exe: nodejs /usr/bin/nodejs found_exe: node /usr/bin/nodejs found_exe: npm /home/kats/.mozbuild/node/bin/npm /usr/bin/env: ‘node’: No such file or directory Could not find npm executable later than 5.6.
Thank you for that, very helpful. Looks like we need to wrap the calls to npm. We're already doing this for eslint itself, but obviously need to do npm as well. Could you try the patch I've just attached? I think that will fix it. If you've already worked around it, then trying this should be enough (as long as node isn't in your path): - Remove <topsrcdir>/node_modules - ./mach eslint --setup
Assignee: nobody → standard8
Priority: -- → P1
The patch seems to work, thanks!
Great, thanks for checking, I'll get that reviewed :-)
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/f851c3e82c2b When setting up ESLint, call npm via node so that node doesn't need to be in the path. r=ahal
Backed out for build bustages Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=f851c3e82c2bad0afd8a2460245c9054c908e79f Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=214074746&repo=autoland&lineNumber=1172 Backout: https://hg.mozilla.org/integration/autoland/rev/02c470cc3f8dcd686cdcda402a514d3c8501ce89
Oops: def check_executable_version(exe, wrap_call_with_node=True): that default should have been False. That could quite easily cause a continuous loop.
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/a177ba2ca668 When setting up ESLint, call npm via node so that node doesn't need to be in the path. r=ahal
You need to log in before you can comment on or make changes to this bug.