Renovate: node-re2 fails to build without python

Created on 23 Aug 2019  路  16Comments  路  Source: renovatebot/renovate

I found this log as part of the Dockerfile.slim failing:

error /usr/src/app/node_modules/re2: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /usr/src/app/node_modules/re2
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", 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:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406: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/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 4.4.0-1060-aws
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/re2
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

I guess this means we need to document Python as a required dependency now?

priority-2-important bug

All 16 comments

After installing python into tsbuild, I'm still getting:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

yes, we need python 2 for that, i'll send a pr.

are the docker builds failing?

Oh wow, I just saw it requires python 2! I'll fix

We don't need python at runtime though, right?

no

ups, yes we don't need at runtime

See PR

i know, trying locally. build failed.

RUN yarn install --production --frozen-lockfile

missing deps on production node deps install. thinking about a solution without needing build deps

Yeah, I just noticed. I saw the build step pass and pushed this PR too soon. I guess we could prune node_modules as last step in the tsbuild intermediate image and then copy node_modules over?

I found a solution:

replace
https://github.com/renovatebot/renovate/blob/9ab041be79e703201da618b89a72302089312f9c/Dockerfile.slim#L39

with

RUN yarn build:docker

RUN yarn install --production --frozen-lockfile

and
https://github.com/renovatebot/renovate/blob/9ab041be79e703201da618b89a72302089312f9c/Dockerfile.slim#L69
with

COPY --from=tsbuild /usr/src/app/node_modules node_modules

I think the same has to be done to the full image?

I think we came up with the same solution. Isn't the full image OK because it already contains Python? Haven't double checked if python 2 is there though

you can just check the docker hub build logs. are they ok?

Oops, nope:

error /usr/src/app/node_modules/re2: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /usr/src/app/node_modules/re2
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 2.7.15 found at "/usr/bin/python2"
gyp http GET https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.16.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.16.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/usr/src/app/node_modules/re2/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/ubuntu/.cache/node-gyp/10.16.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/ubuntu/.cache/node-gyp/10.16.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/ubuntu/.cache/node-gyp/10.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/usr/src/app/node_modules/re2',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
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/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 4.4.0-1060-aws
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/re2
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok

:tada: This issue has been resolved in version 19.31.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings