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

Linux/arm64 CI failing - Cannot find binary for platform linux with architecture arm64 #416

Closed
4 tasks done
GZLiew opened this issue Nov 13, 2022 · 9 comments · Fixed by #445
Closed
4 tasks done
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@GZLiew
Copy link

GZLiew commented Nov 13, 2022

Thank you for reporting a bug! We appreciate it very much. Issues are a big input into the priorities for Pact development

All italic text in this template is safe to remove before submitting

Thanks again!

Software versions

Please provide at least OS and version of pact-js

  • OS: _e.g. Linux
  • Node Version: 16.18.1

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code
  • I have set my log level to debug and attached a log file showing the complete request/response cycle

Expected behaviour

No errors in CI machine

Actual behaviour

getting error

Error: Error while locating pact binary: Cannot find binary for platform 'linux' with architecture 'arm64'.

  | at throwError (/workdir/node_modules/@pact-foundation/pact-core/standalone/install.ts:7:9)
  | at Object.getBinaryEntry (/workdir/node_modules/@pact-foundation/pact-core/standalone/install.ts:51:9)
  | at Object.standalone (/workdir/node_modules/@pact-foundation/pact-core/src/pact-standalone.ts:40:5)
  | at Object. (/workdir/node_modules/@pact-foundation/pact-core/src/pact-standalone.ts:72:16)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/node_modules/@pact-foundation/pact-core/src/server.ts:2:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/node_modules/@pact-foundation/pact-core/src/pact.ts:2:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/node_modules/@pact-foundation/pact-core/src/index.ts:1:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/node_modules/@pact-foundation/src/httpPact/index.ts:2:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/node_modules/@pact-foundation/src/index.ts:25:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .js] (/workdir/node_modules/ts-node/src/index.ts:1608:43)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object. (/workdir/src/create/create.test.ts:2:1)
  | at Module._compile (node:internal/modules/cjs/loader:1155:14)
  | at Module.m._compile (/workdir/node_modules/ts-node/src/index.ts:1618:23)
  | at Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
  | at Object.require.extensions. [as .ts] (/workdir/node_modules/ts-node/src/index.ts:1621:12)
  | at Module.load (node:internal/modules/cjs/loader:1033:32)
  | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
  | at Module.require (node:internal/modules/cjs/loader:1057:19)
  | at require (node:internal/modules/cjs/helpers:103:18)
  | at Object.exports.requireOrImport (/workdir/node_modules/mocha/lib/nodejs/esm-utils.js:49:16)
  | at async Object.exports.loadFilesAsync (/workdir/node_modules/mocha/lib/nodejs/esm-utils.js:91:20)
  | at async singleRun (/workdir/node_modules/mocha/lib/cli/run-helpers.js:125:3)
  | at async Object.exports.handler (/workdir/node_modules/mocha/lib/cli/run.js:370:5)
  | 🚨 Error: The command exited with status 1

@GZLiew GZLiew added the bug Indicates an unexpected problem or unintended behavior label Nov 13, 2022
@mefellows
Copy link
Member

Thanks. I think this is captured elsewhere but will have to look.

See also #407 and #347

@alshdavid
Copy link

alshdavid commented Dec 8, 2022

Running a Linux VM on my M1 Mac, I am unable to install pact on my local project due to this.

➜  test-project uname -mo
aarch64 GNU/Linux

➜  test-project npm i @pact-foundation/pact-node@10.17.6
npm WARN deprecated @types/pino-std-serializers@4.0.0: This is a stub types definition. pino-std-serializers provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/pino-pretty@5.0.0: This is a stub types definition. pino-pretty provides its own type definitions, so you do not need this installed.
npm WARN deprecated libnpmconfig@1.2.1: This module is not used anymore. npm config is parsed by npm itself and by @npmcli/config
npm ERR! code 1
npm ERR! path /root/Development/atlassian/test/node_modules/@pact-foundation/pact-node
npm ERR! command failed
npm ERR! command sh -c node postinstall.js
npm ERR! /root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/standalone/install.js:42
npm ERR!     throw new Error(chalk_1.default.red("Error while installing binary: " + msg));
npm ERR!     ^
npm ERR!
npm ERR! Error: Error while installing binary: Cannot find binary for platform 'linux' with architecture 'arm64'.
npm ERR!     at throwError (/root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/standalone/install.js:42:11)
npm ERR!     at getBinaryEntry (/root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/standalone/install.js:282:11)
npm ERR!     at setup (/root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/standalone/install.js:286:17)
npm ERR!     at /root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/standalone/install.js:319:12
npm ERR!     at Object.<anonymous> (/root/Development/atlassian/test/node_modules/@pact-foundation/pact-node/postinstall.js:3:1)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1105:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
npm ERR!     at node:internal/main/run_main_module:17:47

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-08T01_18_41_776Z-debug-0.log

@mefellows
Copy link
Member

Thanks @alshdavid. I appreciate the problem, but don't have a straightforward solution.

If you are running docker for that "VM", you could add the --platform linux/amd64 flag to emulate x86_64 but appreciate that might not be a long term solution.

I think this package may need to be split, or the (non-Ruby based) code moved from here into Pact JS.

Given that parts of this package (the parts that use the Ruby core) work in some architectures and others don't, I don't think we have much choice other than to state that this package doesn't work in a bunch of architectures, which I think is not right.

@mefellows
Copy link
Member

Please follow this issue pact-foundation/pact-js#1067 for progress.

TL;DR - the CLI which is the root cause of this compatibility issue, will be removed from this project as a dependency in the next major release.

@benjaminlees
Copy link

@mefellows is there a work around for this as it is currently blocking me from using pact in my project.

@mefellows
Copy link
Member

The plan above is to move the ruby binaries out of this project.

For now, there is a workaround listed here: #407

@YOU54F
Copy link
Member

YOU54F commented Apr 18, 2023

I've been making some changes to the travelling-ruby system that we use to package pact-ruby-standalone, in order to support arm64 on osx and linux, it also provides updates to Ruby 3.1.2 and windows 32 bit binaries (currently it only provides 64 bit)

PR here phusion/traveling-ruby#132

Releases here https://github.com/YOU54F/pact-ruby-standalone/releases/tag/v3.1.2.2-alpha

I've tested them out against pact-js-core

https://www.npmjs.com/package/@you54f/pact-core/v/13.14.0?activeTab=code

master...YOU54F:pact-js-core:master

and against the old 9.x.x / pact-node branch

https://www.npmjs.com/package/@you54f/pact-node/v/10.18.0?activeTab=code

The size on the pact-core is concerning tho, it's a chonki boi as it contains the pact ruby standalone and the ffi for every platform, regardless of the downloading platform.

I wondered how small we could make it if we could remove standalone, and ffi from the package and download on pre install with this janky script

https://www.npmjs.com/package/@you54f/pact-core?activeTab=code 499 kB vs 401mb (it currently sits at 215mb https://www.npmjs.com/package/@pact-foundation/pact-core)

But these will suffer from all the problems users have of not being able to run pre/post install scripts, issues downloading binaries.

I think the plan to split out the ruby binaries is properly wise, they can be packaged in a separate npm package, and the uplift for users should be quite small.

@github-actions
Copy link
Contributor

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-964). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

@YOU54F
Copy link
Member

YOU54F commented Jul 6, 2023

pact-js-core now supports linux arm64 for both the pact ruby standalone binaries, and the pact ffi

you can find a version with support for both in

https://www.npmjs.com/package/@pact-foundation/pact-core/v/13.15.0

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

Successfully merging a pull request may close this issue.

5 participants