Ankit Jain
10/19/2022, 10:43 AM~/Contract-Testing-POC/pact-consumer:~ $ npm run pact:publish
> pact-consumer@1.0.0 pact:publish
> pact-broker publish ./pacts --consumer-app-version='1.0.0' --auto-detect-version-properties --broker-base-url=<http://localhost:8000> --broker-username pact_workshop --broker-password pact_workshop
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '../src/pact-standalone'
Require stack:
- /Users/ankitjain/Contract-Testing-POC/pact-consumer/node_modules/.bin/pact-broker
at Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1051:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/Users/ankitjain/Contract-Testing-POC/pact-consumer/node_modules/.bin/pact-broker:7:43)
at Module._compile (node:internal/modules/cjs/loader:1149:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
at Module.load (node:internal/modules/cjs/loader:1027:32)
at Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/ankitjain/Contract-Testing-POC/pact-consumer/node_modules/.bin/pact-broker'
]
}
Node.js v18.10.0Yousaf Nabi (pactflow.io)
consumer/node_modules/.bin there should be a pact-broker stub
./node_modules/.bin/pact-broker
If it is there it probably hasn't downloaded the standalone binaries, are you on a corp proxy by chance?
Were there any errors in the console when running your npm install command?
Some other ways you can get at the CLI tool 👍
https://github.com/pact-foundation/pact_broker-client#installationMatt (pactflow.io / pact-js / pact-go)
Ankit Jain
10/19/2022, 11:41 AMYousaf Nabi (pactflow.io)
Ankit Jain
10/19/2022, 11:47 AMAnkit Jain
10/19/2022, 11:48 AMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Ankit Jain
10/19/2022, 11:51 AMAnkit Jain
10/19/2022, 12:07 PMYousaf Nabi (pactflow.io)
docker run --rm \
-w ${PWD} \
-v ${PWD}:${PWD} \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_USERNAME \
-e PACT_BROKER_PASSWORD \
pactfoundation/pact-cli:latest \
publish \
${PWD}/example/pacts \
--consumer-app-version fake-git-sha-for-demo-$(date +%s) \
--tag-with-git-branch
it won't make it available on your command line.
To do that you need to install the gem, or download the standalone.Ankit Jain
10/19/2022, 12:13 PMYousaf Nabi (pactflow.io)
./pact/bin/
so ./pact/bin/pact-broker will workYousaf Nabi (pactflow.io)
Ankit Jain
10/19/2022, 12:39 PMYousaf Nabi (pactflow.io)