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.63k stars 348 forks source link

10.0.0-beta.45+ npm install fails with node-gyp v8.1.0 on windows #741

Closed schowave closed 3 years ago

schowave commented 3 years ago

Software versions

Please provide at least OS and version of pact-js

Issue Checklist

Please confirm the following:

Expected behaviour

npm install is possible

Actual behaviour

npm install is not possible

Steps to reproduce

How can someone else reproduce this bug?

Use @pact-foundation/pact 10.0.0-beta.45 in your project as devDependency and try to run npm install.

Current workaround for me is to execute npm i -D node-gyp@7.1.0 beforehand, and then the npm install works again. Does this have something to do with https://github.com/nodejs/node-gyp/issues/2399 or https://github.com/nodejs/gyp-next/pull/121 ?

Relevant log files

l-analyse-analysevorgang-frontend\frontend-components
 WARN  @testing-library/user-event@13.2.1 requires a peer of @testing-library/dom@>=7.21.4 but none was installed.
 WARN  @typescript-eslint/eslint-plugin > @typescript-eslint/experimental-utils: eslint-utils@3.0.0 requires a peer of eslint@>=5 but none was installed.
 WARN  @typescript-eslint/eslint-plugin: @typescript-eslint/experimental-utils@4.29.2 requires a peer of eslint@* but none was installed.
 WARN  @typescript-eslint/eslint-plugin@4.29.2 requires a peer of eslint@^5.0.0 || ^6.0.0 || ^7.0.0 but none was installed.
 WARN  @typescript-eslint/parser@4.29.2 requires a peer of eslint@^5.0.0 || ^6.0.0 || ^7.0.0 but none was installed.
 WARN  3 other warnings
Packages: +1824
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1804, reused 1802, downloaded 0, added 0, done
node_modules/.pnpm/core-js-pure@3.17.3/node_modules/core-js-pure: Running postinstall script, done in 258ms
node_modules/.pnpm/core-js@3.17.3/node_modules/core-js: Running postinstall script, done in 260ms
node_modules/.pnpm/core-js@2.6.12/node_modules/core-js: Running postinstall script, done in 420ms
node_modules/.pnpm/ejs@2.7.4/node_modules/ejs: Running postinstall script, done in 426ms
node_modules/.pnpm/ref-napi@3.0.3/node_modules/ref-napi: Running install script, done in 453ms
node_modules/.pnpm/node-sass@6.0.1/node_modules/node-sass: Running install script, done in 812ms
node_modules/.pnpm/node-sass@6.0.1/node_modules/node-sass: Running postinstall script, done in 385ms
node_modules/.pnpm/ffi-napi@4.0.3/node_modules/ffi-napi: Running install script, failed in 5.5s
.../ffi-napi@4.0.3/node_modules/ffi-napi install$ node-gyp-build
│ C:\repos\XXX\frontend\node_modules\.pnpm\ffi-napi@4.0.3\node_modules\ffi-napi>if not defined npm_config_nod
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@8.1.0
│ gyp info using node@14.17.6 | win32 | x64
│ gyp info find Python using Python version 3.9.5 found at "C:\Python39\python.exe"
│ gyp info find VS using VS2019 (16.11.31702.278) found at:
│ gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
│ gyp info find VS run with --verbose for detailed information
│ gyp info spawn C:\Python39\python.exe
│ gyp info spawn args [
│ gyp info spawn args   'C:\\Users\\00169562\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\gyp\\gyp_main.py',
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'msvs',
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\repos\\XXX\frontend\\node_modules\\.pnpm\\ffi-napi@4.0.3\\node_modules\\ffi-na
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\Users\\00169562\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\Users\\00169562\\AppData\\Local\\node-gyp\\Cache\\14.17.6\\include\\node\\common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=C:\\Users\\00169562\\AppData\\Local\\node-gyp\\Cache\\14.17.6',
│ gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\00169562\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\node_modules\\node-gyp',
│ gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\00169562\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.17.6\\\\<(target_arch)\\\\node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=C:\\repos\\XXXX\\frontend\\node_modules\\.pnpm\\ffi-napi@4.0.3\\no
│ 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   'C:\\repos\\XXX\\frontend\\node_modules\\.pnpm\\ffi-napi@4.0.3\\node_modules\\ffi-na
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
│ gyp info spawn args [
│ gyp info spawn args   'build/binding.sln',
│ gyp info spawn args   '/clp:Verbosity=minimal',
│ gyp info spawn args   '/nologo',
│ gyp info spawn args   '/p:Configuration=Release;Platform=x64'
│ gyp info spawn args ]
│ Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm�glichen, m�ssen Sie den Schalter "-m" hinzuf�gen.
│   nothing.vcxproj -> C:\repos\XXX\frontend\node_modules\.pnpm\ffi-napi@4.0.3\node_modules\ffi-napi\build\Re
│   Preprocessing assembly file ..\..\..\deps\libffi\src\x86\win64_intel.preasm
│   Der Befehl ""preprocess_asm.cmd"" ist entweder falsch geschrieben oder
│   konnte nicht gefunden werden.
│ C:\repos\XXX\frontend\node_modules\.pnpm\ffi-napi@4.0.3\node_modules\ffi-napi\build\deps\libffi\ffi.targets
│ gyp ERR! build error 
│ gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onExit (C:\Users\00169562\AppData\Roaming\npm\node_modules\pnpm\dist\node_modules\node-gyp\lib\build.js:194:23)
│ gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
│ gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
│ gyp ERR! System Windows_NT 10.0.19042
│ gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\00169562\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin
│ gyp ERR! cwd C:\repos\XXX\frontend\node_modules\.pnpm\ffi-napi@4.0.3\node_modules\ffi-napi
│ gyp ERR! node -v v14.17.6
│ gyp ERR! node-gyp -v v8.1.0
│ gyp ERR! not ok 
└─ Failed in 5.5s
 ELIFECYCLE  Command failed with exit code 1.
 ERROR  Command failed with exit code 1.
mefellows commented 3 years ago

hmm interesting, it could be. Our Windows builds seem to be passing, but 🤷 .

By any chance, do any of the latter versions work (e.g. beta.49?)

schowave commented 3 years ago

I tried beta.45-49 but none of those seem to work. Only beta.44 works. Maybe this is also a local problem. On our jenkins build machine we had to install gcc-c++ compiler to be able to build it again.

TimothyJones commented 3 years ago

Thanks for the report. It's strange, because we have windows builds running fine in CI.

I think you're right that this is a regression in node-gyp. Since node-gyp is bundled with npm, it's not super clear what we can do to fix it, other than wait for the next version of npm to be released again (I think?).

I'm keen to get to the bottom of why this is happening for you but not in CI - what version of npm are you using? Do you know if you have changed the version of node-gyp from the bundled one?

Our windows builds use npm versions 6.14.12 and 6.14.15 (depending on the node version). For node 14, we use the same version you are using, v14.17.6. Hmm.

schowave commented 3 years ago

We are using the latest version of pnpm and on our CI Server (which is a SUSE Linux Enterprise) we had to install gcc-c++ package for pnpm to be able to build the project with beta.45+

schowave commented 3 years ago

I finally managed to solve the "problem" by deleting the local pnpm store and build everything from scratch again. This is not a problem of pact-js. Sorry for the circumstances!

TimothyJones commented 3 years ago

Glad it's sorted! Thanks for the update!

mefellows commented 3 years ago

Thanks @schowave - did you still need to have gcc-c++ for this to work?

@TimothyJones this is a good reminder. Perhaps we should have a "compatibility" table or something with these sorts of things (e.g. yarn2, npm, pnpm)?

TimothyJones commented 3 years ago

That’s a good idea.

This one will go away, I think. It’s a regression in node gyp 8.1.0 which looks like it is fixed in 8.2.0

TimothyJones commented 3 years ago

We should link to the windows instructions for node-gyp, though. Since it won’t work without node-gyp

schowave commented 3 years ago

We were using an older version of pnpm (6.7.1). With the current version 6.18.0 everything works fine again.

mefellows commented 3 years ago

Thanks for clarifying.