pact-foundation / pact-js-cli

The Broker CLI for Pact, but available to your node scripts
MIT License
1 stars 1 forks source link

pactflow executable not found: ENOENT while spawning it #12

Closed bahamut657 closed 1 week ago

bahamut657 commented 1 week ago

Software versions

Please provide at least OS and version of pact-js

Issue Checklist

Please confirm the following:

Expected behaviour

pactflow executable is runnable

Actual behaviour

 npx --package=@pact-foundation/pact-cli -c 'pactflow'
Need to install the following packages:
@pact-foundation/pact-cli@15.0.2
Ok to proceed? (y) y
/Users/jacopo/.npm/_npx/262fdb08f55da9f8/node_modules/@pact-foundation/pact-cli/bin/pactflow.js:13
    throw error;
    ^

Error: spawnSync standalone/darwin-arm64-2.4.6/pact/bin/pactflow ENOENT
    at Object.spawnSync (node:internal/child_process:1124:20)
    at Object.spawnSync (node:child_process:876:24)
    at Object.<anonymous> (/Users/jacopo/.npm/_npx/262fdb08f55da9f8/node_modules/@pact-foundation/pact-cli/bin/pactflow.js:8:40)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync standalone/darwin-arm64-2.4.6/pact/bin/pactflow',
  path: 'standalone/darwin-arm64-2.4.6/pact/bin/pactflow',
  spawnargs: []
}

Node.js v20.12.2

Steps to reproduce

Try to use pactflow command provided by pact-cli package

bahamut657 commented 1 week ago

Even installing the dependency statically in the package.json file the error persists. It seems related to the cwd used while calling standalone/darwin-arm64-2.4.6/pact/bin/pactflow

YOU54F commented 1 week ago

There are alpine specific dependencies required as the ruby runtime which the pact cli tools rely on is built against glibc not musl, please see the following wiki

https://github.com/pact-foundation/pact-ruby-standalone/wiki/Using-the-pact-ruby-standalone-with-Alpine-Linux-Docker

YOU54F commented 1 week ago

hmm your repro mentions alpine linux, but your console commands are from macos 🤔

YOU54F commented 1 week ago

will get a fix out shortly, have identified the issue (we use the full path for the other binaries, and I hadn't used the correct full path variable for the pactflow binary)

Cheers for the report!