pactflow / example-bi-directional-provider-dredd

bi-directional contracts provider example with OAS, using a BYO testing tool (Dredd)
MIT License
7 stars 59 forks source link

`npm run publish` fails with error "pactflow: not found" #17

Closed marcus-nl closed 2 years ago

marcus-nl commented 2 years ago

When I run npm run publish according to https://docs.pactflow.io/docs/workshops/bi-directional/step4 this error is reported:

> product-service@1.0.0 publish
> pactflow publish-provider-contract oas/products.yml --provider pactflow-example-bi-directional-provider-dredd --provider-app-version $(git rev-parse --abbrev-ref HEAD) --branch $(npx -y absolute-version) --content-type application/yaml --verification-exit-code=0 --verification-results output/report.md --verification-results-content-type "text/plain" --verifier dredd

sh: 1: pactflow: not found

Is the pactflow command supposed to be a part of the @pact-foundation/pact-core devDependency?

Note:

YOU54F commented 2 years ago

do you have the pactflow command along with the pact-broker command in ./node_modules/bin?

Which OS are you running on?

marcus-nl commented 2 years ago

I'm running Ubuntu 20.04 with kernel x86_64 Linux 5.15.0-43-generic. Also npm version 8.55 and Node version 16.16.0

There is indeed a pactflow command in node_modules/@pact-foundation/pact-core/standalone/linux-x64-1.89.02-rc1/pact/bin:

pact
pact-broker
pactflow
pact-message
pact-mock-service
pact-provider-verifier
pact-publish
pact-stub-service

And all these files are executable.

YOU54F commented 2 years ago

the npm command should look up for the binary in /node_modules/.bin/ folder.

What happens if you enter $(npm bin)/pactflow in the package.json command

marcus-nl commented 2 years ago

This is the result of $(npm bin)/pactflow:

bash: ~/ws/playground/pactflow/example-bi-directional-provider-dredd/node_modules/.bin/pactflow: No such file or directory

And this is the result of ll $(npm bin):

total 16
drwxrwxr-x   2 marcus marcus  4096 aug  9 10:33 ./
drwxrwxr-x 342 marcus marcus 12288 aug  9 10:34 ../
lrwxrwxrwx   1 marcus marcus    18 aug  9 10:33 acorn -> ../acorn/bin/acorn*
lrwxrwxrwx   1 marcus marcus    40 aug  9 10:33 concurrently -> ../concurrently/dist/bin/concurrently.js*
lrwxrwxrwx   1 marcus marcus    42 aug  9 10:33 curl-trace-parser -> ../curl-trace-parser/bin/curl-trace-parser*
lrwxrwxrwx   1 marcus marcus    18 aug  9 10:33 dredd -> ../dredd/bin/dredd*
lrwxrwxrwx   1 marcus marcus    23 aug  9 10:33 eslint -> ../eslint/bin/eslint.js*
lrwxrwxrwx   1 marcus marcus    25 aug  9 10:33 esparse -> ../esprima/bin/esparse.js*
lrwxrwxrwx   1 marcus marcus    28 aug  9 10:33 esvalidate -> ../esprima/bin/esvalidate.js*
lrwxrwxrwx   1 marcus marcus    18 aug  9 10:33 gavel -> ../gavel/bin/gavel*
lrwxrwxrwx   1 marcus marcus    19 aug  9 10:33 html -> ../html/bin/html.js*
lrwxrwxrwx   1 marcus marcus    25 aug  9 10:33 js-yaml -> ../js-yaml/bin/js-yaml.js*
lrwxrwxrwx   1 marcus marcus    33 aug  9 10:33 markdown-it -> ../markdown-it/bin/markdown-it.js*
lrwxrwxrwx   1 marcus marcus    14 aug  9 10:33 mime -> ../mime/cli.js*
lrwxrwxrwx   1 marcus marcus    20 aug  9 10:33 mkdirp -> ../mkdirp/bin/cmd.js*
lrwxrwxrwx   1 marcus marcus    20 aug  9 10:33 needle -> ../needle/bin/needle*
lrwxrwxrwx   1 marcus marcus    23 aug  9 10:33 node-which -> ../which/bin/node-which*
lrwxrwxrwx   1 marcus marcus    41 aug  9 10:33 pact -> '../@pact-foundation/pact-core/bin/pact.js'*
lrwxrwxrwx   1 marcus marcus    48 aug  9 10:33 pact-broker -> '../@pact-foundation/pact-core/bin/pact-broker.js'*
lrwxrwxrwx   1 marcus marcus    49 aug  9 10:33 pact-message -> '../@pact-foundation/pact-core/bin/pact-message.js'*
lrwxrwxrwx   1 marcus marcus    54 aug  9 10:33 pact-mock-service -> '../@pact-foundation/pact-core/bin/pact-mock-service.js'*
lrwxrwxrwx   1 marcus marcus    59 aug  9 10:33 pact-provider-verifier -> '../@pact-foundation/pact-core/bin/pact-provider-verifier.js'*
lrwxrwxrwx   1 marcus marcus    54 aug  9 10:33 pact-stub-service -> '../@pact-foundation/pact-core/bin/pact-stub-service.js'*
lrwxrwxrwx   1 marcus marcus    14 aug  9 10:33 pino -> ../pino/bin.js*
lrwxrwxrwx   1 marcus marcus    21 aug  9 10:33 pino-pretty -> ../pino-pretty/bin.js*
lrwxrwxrwx   1 marcus marcus    16 aug  9 10:33 rimraf -> ../rimraf/bin.js*
lrwxrwxrwx   1 marcus marcus    23 aug  9 10:33 semver -> ../semver/bin/semver.js*
lrwxrwxrwx   1 marcus marcus    23 aug  9 10:33 sshpk-conv -> ../sshpk/bin/sshpk-conv*
lrwxrwxrwx   1 marcus marcus    23 aug  9 10:33 sshpk-sign -> ../sshpk/bin/sshpk-sign*
lrwxrwxrwx   1 marcus marcus    25 aug  9 10:33 sshpk-verify -> ../sshpk/bin/sshpk-verify*
lrwxrwxrwx   1 marcus marcus    19 aug  9 10:33 tree-kill -> ../tree-kill/cli.js*
lrwxrwxrwx   1 marcus marcus    21 aug  9 10:33 uuid -> ../uuid/dist/bin/uuid*
lrwxrwxrwx   1 marcus marcus    24 aug  9 10:33 z-schema -> ../z-schema/bin/z-schema*
YOU54F commented 2 years ago

Worked out why now, thanks for the excellent report.

so pact-js-core contains the latest pact-ruby-standalone which contains the pactflow command.

It will be available in the following path

node_modules/@pact-foundation/pact-core/standalone/linux-x64-1.89.02-rc1/pact/bin/pactflow

but is not mapped to the root ./node_modules/bin folder.

It needs two things

  1. A pactflow.js file adding to https://github.com/pact-foundation/pact-js-core/tree/master/bin
  2. An entry for the pactflow command here https://github.com/pact-foundation/pact-js-core/blob/master/package.json#L14

Will update, test and release today 👍🏾

YOU54F commented 2 years ago

Should be fixed by this commit and available in the master branch if you want to grab the latest changes

https://github.com/pactflow/example-bi-directional-provider-dredd/commit/ab33119e9063608dcb890caec1571fe068f2aa2f#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R20

marcus-nl commented 2 years ago

That works! Thanks!

YOU54F commented 2 years ago

Fabulous, will close now, feel free to raise more issues should you come across any other problems