Hi, I am having problems just installing the pact ...
# pact-js
l
Hi, I am having problems just installing the pact dependency into our project - I am running ’ npm i -S @pact-foundation/pact’ and am getting errors on node-gyp rebuild. I have already verified that ignore scripts is false, and have installed node-gyp globally per installation notes here: . I will attach output in a thread. Any help is appreciated - Thanks!
from the terminal:
Copy code
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @pact-foundation/pact-core@13.13.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @pact-foundation/pact-core@13.13.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/m_884005/.npm/_logs/2023-05-31T20_16_32_076Z-debug.log
from the log:
Copy code
3025 verbose stack Error: @pact-foundation/pact-core@13.13.8 install: `node-gyp rebuild`
3025 verbose stack Exit status 1
3025 verbose stack     at EventEmitter.<anonymous> (/Users/m_884005/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
3025 verbose stack     at EventEmitter.emit (events.js:223:5)
3025 verbose stack     at ChildProcess.<anonymous> (/Users/m_884005/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
3025 verbose stack     at ChildProcess.emit (events.js:223:5)
3025 verbose stack     at maybeClose (internal/child_process.js:1021:16)
3025 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
3026 verbose pkgid @pact-foundation/pact-core@13.13.8
3027 verbose cwd /Users/m_884005/Documents/Lineage/repos2/linos-backend/nestjs-monorepo
3028 verbose Darwin 22.3.0
3029 verbose argv "/Users/m_884005/.nvm/versions/node/v12.14.1/bin/node" "/Users/m_884005/.nvm/versions/node/v12.14.1/bin/npm" "i" "-S" "@pact-foundation/pact"
3030 verbose node v12.14.1
3031 verbose npm  v6.13.4
3032 error code ELIFECYCLE
3033 error errno 1
3034 error @pact-foundation/pact-core@13.13.8 install: `node-gyp rebuild`
3034 error Exit status 1
3035 error Failed at the @pact-foundation/pact-core@13.13.8 install script.
3035 error This is probably not a problem with npm. There is likely additional logging output above.
3036 verbose exit [ 1, true ]
node version: 12.14.1, npm version: 6.13.4
t
What OS and arch combination do you have?
m
That’s a very old version of Node - we don’t technically support that version, albeit it might work. Is there a reason you can’t use a later version?
t
oh right, yeah. I reckon that's the problem
l
Agree - they are in the process of upgrading node for the project. What is the minimum version of node version that pact-foundation/pact will work with?
(I did get the npm install to work with node 14.17.0/npm 6.14.13, and I can run my test from the command line successfully, but the nest build breaks on the pact node modules.)
t
I’m not sure. Have a look in the changelog. Dropping support for node 12 will be documented.
Oh, the changelog has all the beta releases in it for some reason. That’s not a very nice read. Hold on
And it wasn’t documented either
It was 11.0.1. The drop of node 12 should have been a breaking change.
Er, apologies, that’s not right either
9.17.3
It should have been a breaking change, but Pact couldn’t release major versions at that time for …reasons.
Sorry about that
I suspect any 9.x line will work for you
it should have made it in to the changelog, perhaps we can retroactively fix that
l
I’m confused now… 9 <12. (I was talking about node versions). I’ve got the latest pact (11.02), and I’m trying to figure out the min version of node I need for it. Thanks
can you send a link to the doc you’re looking at? thanks!
t
It’s the pact-js changelog (in the repo here), but it’s corrupted by the beta releases so it’s hard to read. Also, the information about dropping node 12 isn’t in it.
Apologies, I thought you were asking for the minimum Pact version
the minimum node version for 11.0.2 is 14.
That should be in the changelog too (or at least implied from “dropping support for node 12”)
but it isn’t
I got it from the CI script here
I would recommend the latest 14.x
l
Thanks, Timothy!
t
If you want a specific one, it was last tested in CI on
14.21.3
. You can see that in the logs for the successful runs here: https://github.com/pact-foundation/pact-js/actions/runs/4549309315/jobs/8021248485
l
Thanks, this is really helpful. (I’m a newbie with this.)
t
Sorry for the confusion! The changelog is really nice when it’s not corrupt. If I get a moment later in the month I’ll try to figure out what happened and how it should look
y
I’d recommend moving to node 18 personally node 14 is eol https://endoflife.date/nodejs and there is 3 weeks left for 16.x
We hope to resolve the installation issues for users and remove the requirement for a node gyp build chain in the very near future, there is an open PR at the moment
Thanks for all the support and help as usual Tim!
💯 1