Search code examples
rubypact

Running PACT test is throwing a Ruby Load Error


I am trying to run a pact test for a typescript/angular service, from Visual Studio Code .I am getting the following error:

ERROR (15568 ): pact-node@10.11.11: Pact Binary Error: C:/projects/App/sample.webapp/node_modules/@pact-foundation/pact-node/standalone/win32-1.88.40/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- bundler/setup (ERROR (15568): pact-node@10.11.11: Pact Binary Error: LoadError)
from C:/projects/App/sample.webapp/node_modules/@pact-foundation/pact-node/standalone/win32-1.88.40/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'       

Solution

  • It looks like the infamous windows long path issue. See that issue for further details, but the simplest option is to move your project directory closer to the root of c:.

    For context, Ruby is bundled into Pact JS as a core engine for matching, broker interaction, and verification logic. Our v3 (which does not suffer this issue) is going to have a rust core, you can try out the beta here: https://github.com/pact-foundation/pact-js/#pact-js-v3