question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows 10 Pathing issue on Ruby node_modules

See original GitHub issue

Hi,

I am trying to test some service endpoints with Pact using Windows 10. I am getting a strange ruby error on the require statements on line 1 of the node_module packages when running ./node_modules/.bin/jasmine. The same tests run fine on a Mac, but throw the error stacktrace shown below on Windows. Here are the following details for the Pact libs:

"@pact-foundation/pact-node": "6.19.4"
"jasmine": "3.1.0"
Windows 10 Home v10.0.16299

Here is the test I am trying to run:

const { verifyPacts } = require('@pact-foundation/pact-node');
const path = require('path');

const PACT_ROOT = path.join(__dirname, '../', 'pacts');

const PactOpts = {
  providerBaseUrl: `http://localhost:3000`,
  provider: 'Provider Name',
  pactUrls: [
    path.join(PACT_ROOT, 'data.json')
  ],
  dir: PACT_ROOT,
  log: path.resolve(PACT_ROOT, 'pact.log'),
  logLevel: 'DEBUG',
};

describe('Test pact', () => {

  it('Makes sure pact is running properly', (done) => {
    verifyPacts(PactOpts).then((pactOut) => {
      expect(pactOut).toBeTruthy();
      console.log(pactOut);
      return done();
    }).catch((err) => {
      console.error('-- error:', err);   // this is where the stack trace is being thrown
      expect(err).not.toBeTruthy();
      return done();
    });
  });

Error Stacktrace:

Error: C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/request_handlers/interaction_post.rb:1:in `require': cannot load such file -- pact/mock_service/request_handlers/base_administration_request_handler (LoadError)
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/request_handlers/interaction_post.rb:1:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/request_handlers.rb:1:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/request_handlers.rb:1:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/app.rb:6:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/app.rb:6:in `<top (required)>'

        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/app_manager.rb:8:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.1/lib/pact/mock_service/app_manager.rb:8:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration/mock_service.rb:2:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration/mock_service.rb:2:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration/service_provider.rb:2:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration/service_provider.rb:2:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration.rb:5:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/consumer/configuration.rb:5:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/help/prompt_text.rb:1:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/help/prompt_text.rb:1:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/rspec/formatter_rspec_3.rb:4:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/rspec/formatter_rspec_3.rb:4:in `<top (required)>'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.2/lib/pact/rspec.rb:16:in `require'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.2/lib/pact/rspec.rb:16:in `formatter_class'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:31:in `initialize_rspec'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:18:in `call'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/app.rb:109:in `verify_pact'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/app.rb:29:in `block in call'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/app.rb:28:in `collect'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/app.rb:28:in `call'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/app.rb:22:in `call'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/cli/verify.rb:27:in `verify'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.14.3/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
        from C:/Users/matts/Desktop/Projects/.../node_modules/@pact-foundation/pact-node/standalone/win32-1.47.2/lib/app/pact-provider-verifier.rb:33:in `<main>'

Please let me know if I need to add more information here.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:27 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
bethesquecommented, Jul 12, 2018

That’s very strange. I don’t have a Windows machine, so could you create a git repo of just that code so that I can run it on appveyor?

1reaction
mefellowscommented, Oct 19, 2020

Try looking at the latest (beta) v3 branch for pact js (it won’t have this issue) and also has support for v3 matchers and XML.

Pact node is not a dependency for the v3 parts of that code and should be 👌

EDIT: the v3 version can be obtained through npm, see https://github.com/pact-foundation/pact-js#pact-js-v3 for instructions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 Pathing issue on Ruby node_modules #100
Hi, I am trying to test some service endpoints with Pact using Windows 10. I am getting a strange ruby error on the...
Read more >
Node npm windows file paths are too long to install packages
Running npm install from a standard Windows command prompt fails on deeply nested node_modules hierarchies. Per Joyent's github repo thread, ...
Read more >
Install Ruby on Windows: Everything You Need to Get Going
Installing Ruby on Windows used to be a pain. Things have come a long way since then. Here's how to install Ruby on...
Read more >
The node_modules problem - DEV Community ‍ ‍
As I've said, the problem when copying node_modules folder from one place to another is not the size, it is the amount of...
Read more >
Manage npm packages - Visual Studio (Windows)
Visual Studio helps you to manage packages using the Node.js package manager (npm)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found