New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node, yarn: fix node-gyp after python3 -> python rename #24870

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@chrmoritz
Contributor

chrmoritz commented Mar 5, 2018

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

The python3 to python rename from #24604 has broken node-gyp, because it expects that python (on the $PATH) to be version 2.7.x.

Fixes: #24869 (look at this for additional context)

BTW: This issue was covered by our native addon test (brew test node is failing without this atm), but I can understand that you couldn't run all formulaes test in #24604.

@chrmoritz chrmoritz referenced this pull request Mar 5, 2018

Closed

python3 -> python rename has broken node-gyp #24869

5 of 6 tasks complete
@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 5, 2018

Updated this PR to fix our local pristine npm/node-gyp copy in libexec too.

cc @ilovezfs and @DomT4 for reviewing node stuff

@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 5, 2018

I can't reproduce the test failure locally (bignum builds fine for me), but this is the error on the bot:

gyp verb check python checking for Python executable "/usr/local/opt/python@2/bin/python2" in the PATH
gyp verb `which` failed Error: not found: /usr/local/opt/python@2/bin/python2

Why does this path to the python2 executable does not exist on the bot? Is it's python2 not fully migrated yet?

log from npm
npm verb stack Error: bignum@0.12.5 install: `node-pre-gyp install --fallback-to-build`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
npm verb stack     at EventEmitter.emit (events.js:127:13)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:127:13)
npm verb stack     at maybeClose (internal/child_process.js:936:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
npm verb pkgid bignum@0.12.5
npm verb cwd /private/tmp/node-test-20180305-26439-1amyskl
npm verb Darwin 16.7.0
npm verb argv "/usr/local/Cellar/node/9.7.1/bin/node" "/usr/local/bin/npm" "-ddd" "--cache=/Users/brew/Library/Caches/Homebrew/npm_cache" "--build-from-source" "install" "bignum"
npm verb node v9.7.1
npm verb npm  v5.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bignum@0.12.5 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bignum@0.12.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brew/Library/Caches/Homebrew/npm_cache/_logs/2018-03-05T17_28_30_489Z-debug.log
Error: node: failed
log from node-gyp (before the dep tree)
gyp verb check python checking for Python executable "/usr/local/opt/python@2/bin/python2" in the PATH
gyp verb `which` failed Error: not found: /usr/local/opt/python@2/bin/python2
gyp verb `which` failed     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb `which` failed  /usr/local/opt/python@2/bin/python2 { Error: not found: /usr/local/opt/python@2/bin/python2
gyp verb `which` failed     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb `which` failed   stack: 'Error: not found: /usr/local/opt/python@2/bin/python2\n    at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)\n    at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)\n    at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)\n    at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16\n    at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5\n    at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:170:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "/usr/local/opt/python@2/bin/python2", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:170:21)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/9.7.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum/binding/bignum.node" "--module_name=bignum" "--module_path=/private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum/binding" "--python=/usr/local/opt/python@2/bin/python2"
gyp ERR! cwd /private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum
gyp ERR! node -v v9.7.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/9.7.1/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum/binding/bignum.node --module_name=bignum --module_path=/private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum/binding --python=/usr/local/opt/python@2/bin/python2' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/private/tmp/node-test-20180305-26439-1amyskl/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:936:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Darwin 16.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/9.7.1/bin/node" "/private/tmp/node-test-20180305-26439-1amyskl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /private/tmp/node-test-20180305-26439-1amyskl/node_modules/bignum
node-pre-gyp ERR! node -v v9.7.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
npmrc.atomic_write("prefix = #{HOMEBREW_PREFIX}\n")
npmrc = <<~EOS
prefix = #{HOMEBREW_PREFIX}
python = #{Formula["python@2"].opt_bin}/python2\n

This comment has been minimized.

@ilovezfs

ilovezfs Mar 5, 2018

Contributor

why aren't we just using system python

This comment has been minimized.

@chrmoritz

chrmoritz Mar 5, 2018

Contributor

A thx, that was the issue, it worked for me because I have python@2 installed. But we need to use python@2 on MacOS.version <= :snow_leopard.

This comment has been minimized.

@ilovezfs

ilovezfs Mar 5, 2018

Contributor

probably can just set python = python2.7

This comment has been minimized.

@ilovezfs

ilovezfs Mar 5, 2018

Contributor

but really I'm fine with python = /usr/bin/python

the depends_on "python@2" if MacOS.version <= :snow_leopard at this point just means "this uses python 2"

This comment has been minimized.

@chrmoritz

chrmoritz Mar 5, 2018

Contributor

I mean if we always set python=/usr/bin/python it will not work on snow leopard or lower.

This comment has been minimized.

@ilovezfs

ilovezfs Mar 5, 2018

Contributor

right. that's my point. no one really expects it to.

This comment has been minimized.

@DomT4

DomT4 Mar 5, 2018

Contributor

I don't think it's worth trying to support 10.6 and below unless anyone comes complaining, personally. This is one of the few things we actually try to do because it requires minimal effort, but the result of that is likely that a lot of core formulae are 💀on <=10.6 anywhere where the issue is more than extremely minor.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 5, 2018

Why does this path to the python2 executable does not exist on the bot? Is it's python2 not fully migrated yet?

it would need to depend on python@2, which isn't really in the cards here. we should use system python

@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 5, 2018

The issue should now be fixed by using python=/usr/bin/python and only on snow leapard or lower python=Formula["python@2"].opt_bin/"python2".

probably can just set python = python2.7

But we can't just set python=python2.7 because python@2 is keg-only and it won't be on the $PATH.

@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 5, 2018

@ilovezfs Whats the decision on dropping OS X <=10.6 support (at least native addon support, js node isn't affected by this)? I want to start backport this fix to the versioned node formulaes and I need to know if I should keep the conditional python location or just assume /usr/local/python? At least node@4 does still officially support 10.6 (it was dropped with node@6).

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 5, 2018

But we can't just set python=python2.7 because python@2 is keg-only and it won't be on the $PATH.

Mythical creatures on snow leopard would probably have run brew link -f python@2.

But we should just use /usr/bin/python.

@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 5, 2018

Mythical creatures on snow leopard would probably have run brew link -f python@2.

But we should just use /usr/bin/python.

I read this as +1 for dropping native addon support on OS X <=10.6.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 5, 2018

Correct.

@chrmoritz chrmoritz referenced this pull request Mar 5, 2018

Closed

node@4/6/8: fix node-gyp after python3 -> python rename #24874

4 of 4 tasks complete

@chrmoritz chrmoritz changed the title from node: fix node-gyp after python3 -> python rename to node, yarn: fix node-gyp after python3 -> python rename Mar 5, 2018

@ilovezfs ilovezfs added the python label Mar 6, 2018

@@ -19,7 +20,6 @@ class Node < Formula
deprecated_option "enable-debug" => "with-debug"
depends_on "python@2" => :build if MacOS.version <= :snow_leopard

This comment has been minimized.

@ilovezfs

ilovezfs Mar 6, 2018

Contributor

We should leave this in the formula for now. I don't want to start mass removing these wherever we think it may not actually work.

This comment has been minimized.

@chrmoritz
@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 6, 2018

Thanks @chrmoritz!

@ilovezfs ilovezfs closed this in e5f7031 Mar 6, 2018

@chrmoritz

This comment has been minimized.

Contributor

chrmoritz commented Mar 6, 2018

@ilovezfs: Does the high sierra bot have some sort of a known network issues? I've only seen the flaky ENOTFOUND registry.npmjs.org on the high sierra bot, but not on any other bot so far.

@ilovezfs

This comment has been minimized.

Contributor

ilovezfs commented Mar 6, 2018

nope

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.