Skip to content
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 10 Pathing issue on Ruby node_modules #100

Closed
mattstankey opened this issue Jul 12, 2018 · 27 comments
Closed

Windows 10 Pathing issue on Ruby node_modules #100

mattstankey opened this issue Jul 12, 2018 · 27 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@mattstankey
Copy link

mattstankey commented Jul 12, 2018

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.

@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior triage labels Jul 12, 2018
@bethesque
Copy link
Member

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?

@mboudreau
Copy link
Contributor

This could be related to the long pathing issue. @mattstankey can you reduce the path length of your project and see if it works? If it doesn't, could you recreate a small demo project and put it somewhere for me to try on my machine? Thanks.

@mboudreau
Copy link
Contributor

I can confirm that this issue is related to the long path limitation of windows. Feel free to fix it on windows by setting the appropriate registry key.

@mattstankey
Copy link
Author

Yes, after moving the project to C;/[project_name] it does work for me. It looks like this is an issue with Windows 10 path length. I'm not sure if it is specifically related to Ruby or not, but it doesn't seem to be related to pact-node.

Thanks!

@mboudreau
Copy link
Contributor

@mattstankey did you see my solution above?

@LeeGDavis
Copy link

I imagine this is a limitation of Ruby in Windows 10 with long path support. I don't know what you need to overcome this since MS doesn't have this limitation anymore. However, it is opt-in, even on more current builds.

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior. MSDN Article

https://bugs.ruby-lang.org/issues/12551
https://bugs.ruby-lang.org/issues/14631

I can confirm that this is still an issue with https://github.com/pact-foundation/pact-node/blob/master/README.md#enable-long-paths enabled and moving this to a shorter directory path like like a root drive like /c/myapp or /d/myapp the problem goes away. Python 3.x and Node for example seem to work fine with long paths on windows when you have opted in of course.

I hope this helps.

@mboudreau
Copy link
Contributor

@LeeGDavis Why would it be a ruby limitation if it only happens in Windows? I do believe the file access is done with C in ruby, hence it should be using the windows file api and should adhere to the long path solution.

@mboudreau mboudreau reopened this Jul 19, 2018
@LeeGDavis
Copy link

@mboudreau I would say it is a limitation in Ruby based on its usage of the underlying c runtime. It is a relatively new thing vendors have started to support, I think mid 2016. My assumption is they haven't taken the steps necessary to fully implement whatever is needed to support long paths. I believe it has to do with how file names are referenced, so that different versions of the api are called that support long paths. It seems they know about the issue and I imagine someone in the community will tackle this.

@mboudreau
Copy link
Contributor

mboudreau commented Jul 19, 2018 via email

@LeeGDavis
Copy link

@mboudreau have a look at this issue https://bugs.ruby-lang.org/issues/12551. While I don't know if this is exactly representative of what is being observed here, I imagine it is related. They even reference the long path prefix \\?\ to cause the api to call into the unicode version of the api. I suppose one could always use WSL 😀

@mboudreau
Copy link
Contributor

@LeeGDavis I might have found a solution, but dropping the binary files in the user's tmp directory, which should be a lot less long. Let me try it out and I'll release a new fix version and see if that helps you in your situation.

@mboudreau
Copy link
Contributor

hey @LeeGDavis,

I think I may have a fix for you. #103

Maybe you'd want to pull the files, build and test it out. It should download the binaries to the temp directory, which should be a lot less long than your project path.

Cheers,

M

@mboudreau
Copy link
Contributor

@LeeGDavis @mattstankey disregard my last comment, I've released a version, 6.19.8-rc, if you could please update your dependencies to it and try it out to see if you hit the same issue. Cheers.

@LeeGDavis
Copy link

@mboudreau I can't seem to locate that version. Is there anything special I need to do to pull that down?

@mboudreau
Copy link
Contributor

@LeeGDavis Sorry, seems like it had skipped the deployment, my bad. I redeployed it properly now, please try again.

@LeeGDavis
Copy link

@mboudreau Looks like this is still an issue, however this error looks different. I hope this stack trace helps:

[�[37m2018-07-20T03:57:49.425Z�[39m] �[36m INFO�[39m: pact-node@6.19.8-rc/4256 on COMPUTERNAME: �[36mVerifying Pacts.�[39m
[�[37m2018-07-20T03:57:49.428Z�[39m] �[36m INFO�[39m: pact-node@6.19.8-rc/4256 on COMPUTERNAME: �[36mVerifying Pact Files�[39m
[�[37m2018-07-20T03:57:49.437Z�[39m] �[36m INFO�[39m: pact-node@6.19.8-rc/4256 on COMPUTERNAME: �[36mCreated 'win32-1.52.2\bin\pact-provider-verifier.bat '/Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json' --provider-base-url 'http://localhost:4000' --custom-provider-header 'Authorization: Bearer 123'' process with PID: 11904�[39m
[�[37m2018-07-20T03:57:50.482Z�[39m] �[35m WARN�[39m: pact-node@6.19.8-rc/4256 on COMPUTERNAME: �[36mPact exited with code 1.�[39m
F

Failures:
1) Enforcing contract tests Fullfills testing contracts with the web UI consumer
  Message:
    Expected Error: Error reading file from /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json
    
    No such file or directory @ rb_sysopen - /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `read'
    C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `get_local'
    C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
    C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
    C:/Users/sco ... not to be truthy.
  Stack:
    Error: Expected Error: Error reading file from /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json
        at <Jasmine>
        at verifyPacts.then.catch (D:\Projects\client\application-dir\long-application-name-service\spec\contract.pact.js:26:23)
        at _rejected (D:\Projects\client\application-dir\long-application-name-service\node_modules\q\q.js:864:24)
        at D:\Projects\client\application-dir\long-application-name-service\node_modules\q\q.js:890:30
        at Promise.when (D:\Projects\client\application-dir\long-application-name-service\node_modules\q\q.js:1142:31)

1 spec, 1 failure
Finished in 1.073 seconds
Randomized with seed 33993 (jasmine --random=true --seed=33993)
]
Serverless: exec stderr: [-- error: Error: Error reading file from /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json

No such file or directory @ rb_sysopen - /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `read'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `get_local'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `collect'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:60:in `run_with_pact_uri'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:48:in `run_specs'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:111:in `verify_pact'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:29:in `block in call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `collect'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:22:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/verify.rb:27:in `verify'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/app/pact-provider-verifier.rb:33:in `<main>'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `read': No such file or directory @ rb_sysopen - /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json (Errno::ENOENT)
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `get_local'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `collect'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:60:in `run_with_pact_uri'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:48:in `run_specs'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.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/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:111:in `verify_pact'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:29:in `block in call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `collect'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:22:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/verify.rb:27:in `verify'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/app/pact-provider-verifier.rb:33:in `<main>'

    at ChildProcess.<anonymous> (D:\Projects\client\application-dir\long-application-name-service\node_modules\@pact-foundation\pact-node\src\verifier.js:130:68)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:131:20)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
]
Serverless: Offline error executing script [Error: Command failed: cross-env IS_TEST=true ./node_modules/.bin/jasmine --config=./spec/support/contract.json
-- error: Error: Error reading file from /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json

No such file or directory @ rb_sysopen - /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `read'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `get_local'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `collect'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:60:in `run_with_pact_uri'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:48:in `run_specs'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:111:in `verify_pact'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:29:in `block in call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `collect'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:22:in `call'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/verify.rb:27:in `verify'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/app/pact-provider-verifier.rb:33:in `<main>'
C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `read': No such file or directory @ rb_sysopen - /Projects/client/application-dir/long-application-name-service/pacts/long_application_name_ui-long_application_name_api.json (Errno::ENOENT)
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:49:in `get_local'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `collect'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:60:in `run_with_pact_uri'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:48:in `run_specs'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-1.28.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.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/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:111:in `verify_pact'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:29:in `block in call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `collect'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:28:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/app.rb:22:in `call'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/verify.rb:27:in `verify'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.15.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
	from C:/Users/scoobydoo/AppData/Local/Temp/pact/win32-1.52.2/lib/app/pact-provider-verifier.rb:33:in `<main>'

    at ChildProcess.<anonymous> (D:\Projects\client\application-dir\long-application-name-service\node_modules\@pact-foundation\pact-node\src\verifier.js:130:68)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:131:20)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
]
Serverless: Halting offline server

@mboudreau
Copy link
Contributor

Okay, that's better. I means that the Pact binary is running, but now the binary is having issues opening the file that's more than 260 characters. We might be able to fix this.

@bethesque As per Microsoft's article, could you maybe have the binary prepend \\?\\ to windows files paths to enable long path support?

@bethesque
Copy link
Member

If the ruby code needs changing, I can do that, but I think you should be able to pass in the path with the right prefix?

@mboudreau
Copy link
Contributor

@bethesque I can to just test it out, however, I think it should be fixed from the Ruby end since this particular issue would affect every language that uses it.

@bethesque
Copy link
Member

Fair point. See how it goes.

@ddemierre
Copy link

Hi, did anything ever happen re: the \\?\\ prefix? This is currently causing issues for my team, am trying to work out where to go from here

@mefellows
Copy link
Member

mefellows commented May 28, 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.

@ddemierre
Copy link

ddemierre commented May 29, 2020

Thanks for the suggestion @mefellows, pact js v3 isn't giving me this issue any more - but now the mock service is refusing connections!

(edit: testFn was missing a return statement. now getting an actual, workable test failure)

@mefellows
Copy link
Member

Thanks for the update - I wonder if we can check for the correct shape of the function and error better.

@pulgupta
Copy link

Hi All, I am also getting this error on windows machine. Is there a solution for this already?
`require': cannot load such file -- pact/consumer/mock_service/cors_origin_header_middleware (LoadError)

@mefellows
Copy link
Member

The solution is described above @pulgupta

@mefellows
Copy link
Member

Closing as latest version removes Ruby and this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants