pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.62k stars 344 forks source link

pact-js not installing on Amazon Linux 2 CodeBuild image with no real information in the logs #1053

Closed csydvs closed 1 year ago

csydvs commented 1 year ago

Software versions

Issue Checklist

Please confirm the following:

Expected behaviour

Be able to install on an Amazon LInux 2 image.

Actual behaviour

Just went through to upgrade my project to the latest version of Pact JS so that I can take care of the V3 specification, and everything is working fine on my local (Mac OS) machine, but as soon as I ship my changes up to a build server and run an npm ci, I get errors the following error:

> @pact-foundation/pact-core@13.13.4 install /codebuild/output/src***/src/bitbucket.org/***/node_modules/@pact-foundation/pact-core
--
271 | > node-gyp rebuild
272 |  
273 | make: Entering directory `/codebuild/output/*****/src/bitbucket.org/*****/node_modules/@pact-foundation/pact-core/build'
274 | CXX(target) Release/obj.target/pact/native/addon.o
275 | CXX(target) Release/obj.target/pact/native/ffi.o
276 | CXX(target) Release/obj.target/pact/native/consumer.o
277 | CXX(target) Release/obj.target/pact/native/provider.o
278 | CXX(target) Release/obj.target/pact/native/plugin.o
279 | SOLINK_MODULE(target) Release/obj.target/pact.node
280 | /bin/sh: *****user*****: No such file or directory
281 | make: *** [Release/obj.target/pact.node] Error 127
282 | make: Leaving directory `/codebuild/output/*****/src/*****/node_modules/@pact-foundation/pact-core/build'
283 | gyp ERR! build error
284 | gyp ERR! stack Error: `make` failed with exit code: 2
285 | gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
286 | gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
287 | gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
288 | gyp ERR! System Linux 4.14.281-212.502.amzn2.x86_64
289 | gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
290 | gyp ERR! cwd /codebuild/output/src347170380/src/*****/node_modules/@pact-foundation/pact-core
291 | gyp ERR! node -v v14.21.2
292 | gyp ERR! node-gyp -v v5.1.0
293 | gyp ERR! not ok
294 | npm ERR! code ELIFECYCLE
295 | npm ERR! errno 1
296 | npm ERR! @pact-foundation/pact-core@13.13.4 install: `node-gyp rebuild`
297 | npm ERR! Exit status 1
298 | npm ERR!
299 | npm ERR! Failed at the @pact-foundation/pact-core@13.13.4 install script.
300 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
301 |  
302 | npm ERR! A complete log of this run can be found in:
303 | npm ERR!     /root/.npm/_logs/2023-02-02T22_34_55_112Z-debug.log

Steps to reproduce

Just trying to run npm ci on a repository that has the latest version of pact-js on the aforementioned build server. I don't know of any way to make your postinstall script more verbose, but I'll keep looking into that.

Notes

I've seen that you don't support Alpine, and although I'm not a standard C library guy, I think Red Hat uses glibc? I do know that when I run

ldd --version
--
96 | ldd (GNU libc) 2.26
97 | Copyright (C) 2017 Free Software Foundation, Inc.
98 | This is free software; see the source for copying conditions.  There is NO
99 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
100 | Written by Roland McGrath and Ulrich Drepper.

which the onlines makes me think I'm on a supported version? I also don't have any issues with python, tried making sure I was on Python 3.9 and got the same error.

csydvs commented 1 year ago

Turns out, I had an environment variable named LINK in my environment, that was the issue here.

mefellows commented 1 year ago

Thanks for sharing! Hopefully if anybody else runs into the issue, they'll find this 👍