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.59k stars 343 forks source link

Issue getting @pact-foundation/pact module to load #1086

Closed AlisonYoon closed 1 year ago

AlisonYoon commented 1 year ago

Software versions

OS: Mac OS Ventura 13.3.1 Node version: 14.21.1 @pact-foundation/pact: ^11.0.2 @pact-foundation/pact-core: ^13.13.4

Issue Checklist

Please confirm the following:

Expected behaviour

fill in here

Actual behaviour

Pact testing failure with below error message.

  dlopen(/Users/alison.yoon/Developer/kraken-core/src/octoenergy/interfaces/node_modules/@pact-foundation/pact-core/build/Release/pact.node, 0x0001): Library not loaded: @rpath/libpact_ffi.dylib
      Referenced from: <409E86F7-030E-31C9-8506-0E6A80B0F755> /Users/alison.yoon/Developer/kraken-core/src/octoenergy/interfaces/node_modules/@pact-foundation/pact-core/build/Release/pact.node
      Reason: tried: '/Users/alison.yoon/Developer/kraken-core/src/octoenergy/interfaces/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.dylib' (no such file), '/Users/alison.yoon/Developer/kraken-core/src/octoenergy/interfaces/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.dylib' (no such file), '/usr/local/lib/libpact_ffi.dylib' (no such file), '/usr/lib/libpact_ffi.dylib' (no such file, not in dyld cache)

      at Runtime._loadModule (node_modules/jest-runtime/build/index.js:1180:29)
      at bindings (../../node_modules/bindings/bindings.js:112:48)
      at Object.<anonymous> (../../node_modules/@pact-foundation/pact-core/src/ffi/index.ts:6:21)

Steps to reproduce

In Mac OS Ventural 13.3.1, in a project, install pact testing package, write some tests and run it.

TimothyJones commented 1 year ago

A few questions:

I have MacOS Ventura 13.3.1, and no trouble running Pact. Could you be more specific in your reproduction instructions?

mefellows commented 1 year ago

You can see the paths of the library it is trying to install.

      '/Users/alison.yoon/Developer/kraken-core/src/octoenergy/interfaces/node_modules/@pact-foundation/pact-core/build/Release/libpact_ffi.dylib' (no such file)
      '/usr/local/lib/libpact_ffi.dylib' (no such file)
      '/usr/lib/libpact_ffi.dylib' (no such file, not in dyld cache)

It's interesting that it's found (and compiled) the pact.node native interface, but hasn't found the library. I wonder if they are somehow installed in a different place. Are you running a monorepo by any chance and the root project is in /Users/alison.yoon/Developer/kraken-core/?

Could you please run this command from that folder please: find . -name libpact_ffi.dylib

Also, could you please confirm if you're running from a Rosetta mode enabled? If not, I'd expect it to be loading a slightly different file.

mefellows commented 1 year ago

Closing due to inactivity.