-
Notifications
You must be signed in to change notification settings - Fork 79
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
Windows 11: Exception during run: TypeError: Cannot read properties of undefined (reading 'pactffiInitWithLogLevel') #608
Comments
Pact-JS does work on windows 11 machines ( I have two that I use at home for developing both pact-js-core and testing), so there is some other issue here |
Any chance you could please create a repro? Perhaps forking https://github.com/mefellows/pact-js-repro-template (it might be a little out of date now, but should be easy to update) and sharing your forked project that demonstrates the issue? |
OK, so I found the problem After you said that you have it working on your Windows OSs I started to think what is the difference between my Windows 10 where everything working fine and Windows 11 envs. The difference is that on Windows 10 a long time ago I was using Node.js installed from installer before switching to NVM, on windows 11 I am using just nvm. The problem is that I used nvm to install Node.js. As a result, I have not installed dependencies that are automatically installed after nodejs installation using an installer downloaded from the official site. So probably dependencies are like python visualstudio2022-workload-vctools as it is said in node-gyp instructions, but node-gyp is required for pact version lower then 11? So maybe it would be a good time to update installation instructions for those who are using NVM or other node version manager tools? I mean what dependencies, because nodejs post-install script downloads and installs a lot of staff PS |
v10-v11 require node-gyp for the build process. v12 + prebuilds dependencies so removes this requirement v9 and below never had this requirement in the first place I use a combo of nvm / nvs on macos, nvm on windows with no issues. I previously had nvm 1.1.0 with node 16 installed on my laptop directly from the gh releases executable https://github.com/coreybutler/nvm-windows however I have re-tried with latest nvm installed via choco and node 22.14.0 and all good. (windows 11 pro 23H2) using this repo updated pact to v14 and pact-cli to 16.0.5 npm install / npm test - ✅ |
are you sure that you Windows machine had no nodejs installation before? I am using clean windows with just VS code installed and nvm with node v22 and the problem happened |
I tried again in a clean Win11 VM (ARM64 on MacOS M1) Had the same issue as yourself with nvm and nvs due to them not bundling the additional support packages.
You are correct that the official nodejs installer for windows supports the additional options Following the link shown takes us to https://github.com/nodejs/node-gyp?tab=readme-ov-file#on-windows Where we can see the instruction (to be run in a powershell session with admin priviledges) choco install python visualstudio2022-workload-vctools -y Now I will note that this didn't install cleanly
Here are the installed packages
However I was able to successfully execute the pact tests after this
Where previously I would see the same as your initial issue. Therefore I think its prudent to update the documents to state that windows users using the official nodejs package will need to tick that option, and other uses with nvs/nvm/volta or a direct install of node-js will require these support packages noted in https://github.com/nodejs/node-gyp?tab=readme-ov-file#on-windows, on a bare install. Thanks for raising and helping reduce the size of the haystack! |
Software versions
Please provide at least OS and version of pact-js
Issue Checklist
Please confirm the following:
Expected behaviour
Windows 11 should support pact tests like the Windows 10 does
Actual behaviour
Exception during run: TypeError: Cannot read properties of undefined (reading 'pactffiInitWithLogLevel')
Steps to reproduce
On a Windows 11 machine install @pact-foundation/pact": "^14.0.0", and write some test that has
The execution will fail before mocha (test framework begin to lunch test)
The text was updated successfully, but these errors were encountered: