Hello. I would appreciate some help with the error...
# pact-broker
m
Hello. I would appreciate some help with the errors below. I am new to pact and I am trying to publish my consumer test pact to the broker but
win32-1.89.02-rc1\pact\bin\pact-broker.bat
is missing from
node_modules\@pact-foundation\pact-node\standalone\
. I am using pact-node -v
^10.17.6
Copy code
personal-media@0.1.0 test:publish
node publish.js

[2022-11-28 17:55:35.334 +0000] INFO (13664 on DESKTOP-1H0P31U): pact-node@10.17.6: Publishing Pacts to Broker
[2022-11-28 17:55:35.336 +0000] INFO (13664 on DESKTOP-1H0P31U): pact-node@10.17.6: Publishing pacts to broker at: <https://cloudmargin.pactflow.io>
[2022-11-28 17:55:35.368 +0000] ERROR (13664 on DESKTOP-1H0P31U): pact-node@10.17.6: spawn C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\@pact-foundation\pact-node\standalone\win32-1.89.02-rc1\pact\bin\pact-broker.bat ENOENT
    Error: spawn C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\@pact-foundation\pact-node\standalone\win32-1.89.02-rc1\pact\bin\pact-broker.bat ENOENT
        at notFoundError (C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\cross-spawn\lib\enoent.js:6:26)
        at verifyENOENT (C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\cross-spawn\lib\enoent.js:40:16)
        at ChildProcess.cp.emit (C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\cross-spawn\lib\enoent.js:27:25)
        at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
[2022-11-28 17:55:35.369 +0000] WARN (13664 on DESKTOP-1H0P31U): pact-node@10.17.6: Pact exited with code 1.
[2022-11-28 17:55:35.370 +0000] ERROR (13664 on DESKTOP-1H0P31U): pact-node@10.17.6: Pact publication failed with non-zero exit code. Full output was:       
The system cannot find the path specified.

Pact contract publishing failed:  Error: Pact publication failed with non-zero exit code. Full output was:
The system cannot find the path specified.

    at ChildProcess.<anonymous> (C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\@pact-foundation\pact-node\src\publisher.js:79:40)   
    at Object.onceWrapper (node:events:510:26)
    at ChildProcess.emit (node:events:402:35)
    at ChildProcess.cp.emit (C:\Users\sanmi\OneDrive\Desktop\New folder\personal-media\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
 *  Terminal will be reused by tasks, press any key to close it.
m
My guess is that you’re hitting the windows long path issue.
You’ll need to bring the CLI closer to
c:\
or consider using the docker image
(search long path issue in Pact JS and you should find some other workarounds also)
m
@Matt (pactflow.io / pact-js / pact-go) Thanks for your reply. I was able to resolve it by downgrading to
@pact-foundation/pact-node@10.17.2
🤔 1
t
The version of the standalone in 10.17.3 is a rc, which means it has a longer path name.
b
Can you use Docker instead of the standalone?
t
That would address this, but it’s more ergonomic in node to use the CLI directly. I don’t know if pact-node is still being released, but I’ve made https://github.com/pact-foundation/pact-js-core/pull/419 , which would fix the regression of an extra three characters in the path introduced in 10.17.3 by updating the standalone to 1.91.0
m
Thanks Tim. Will pull that in tomorrow
t
Awesome! I should add - I haven’t tested that at all - and of course CI doesn’t run on PRs to pact-node’s branch
m
I moved my code folder closer to C:/ and that fixed the earlier problem I was having with the latest version. So all good on this. Thanks Guys and @Matt (pactflow.io / pact-js / pact-go)
👍 1
m
FYI sorry for the delay, 10.17.7 of the core has been released - if you do an update of the dependencies in your Pact JS project, it should bump the patch version for the dependency that was taking up a few extra chars in your path 🙂