argos-ci / argos-javascript

Official Argos SDKs for JavaScript
https://docs.argos-ci.com
MIT License
8 stars 9 forks source link

Error: Could not load the "sharp" module using the linux-x64 runtime #125

Closed mlajx closed 6 months ago

mlajx commented 6 months ago

Bug description

On my local, I get the following error after taking the screenshot with Argos 2.0.1:

Error: Could not load the "sharp" module using the linux-arm64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
    yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=linux --cpu=arm64 sharp
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/app/node_modules/sharp/lib/sharp.js:114:9)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/app/node_modules/sharp/lib/index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at cjsLoader (node:internal/modules/esm/translators:366:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:315:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async Object.exports.upload (/app/node_modules/@argos-ci/core/dist/index.cjs:3:24)
    at async Object.handler (/app/node_modules/@argos-ci/cypress/dist/task.cjs:27:21)

On CI, I'm getting the following error after taking the screenshot with Argos 2.0.1:

Error: Could not load the "sharp" module using the linux-x64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
    yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/app/node_modules/sharp/lib/sharp.js:114:9)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/app/node_modules/sharp/lib/index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .js] (/root/.cache/Cypress/13.8.1/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)

Correct behavior expected

The sharp library should not fail.

Wrong behavior observed

The sharp library failed to be loaded apparently because of the OS, however, everything looks fine, we are using the official Cypress image and I tried with the official Node Image either.

Reproduce

I'm not sure, but I have assumptions this is related to the incompatibility with Cypress or Node docker images

Setup

OS: MacOS M2 Pro Docker Desktop Version: 4.29.0 Cypress Official Image: 13.8.1 Argos Version: 2.0.1 Yarn Version: 4.1.1 Node Version: v20.12.2

On CI everything is the same, except the OS, we are using CircleCI and the OS is ubuntu-2204:2024.01.1

gregberge commented 6 months ago

Hi @mlajx, it's not related to Argos, we just use the latest sharp library so I think you should give a look on sharp repository.

mlajx commented 6 months ago

Hey @gregberge, I discovered the cause of the issue, it's an incompatibility with the OS versions. Our node image runs on Alpine, the official Cypress image runs on Debian. Probably yarn is installing the dependencies and caching based on OS, and when we try to run in another Linux OS it fails. I'll close this bug report because it's unrelated to Argos-CI and Sharp.

By the way, I tried to enter your discord group from the header link on your site, but the invitation link expired 😢 .

jsfez commented 6 months ago

Hi @mlajx, you will find here the link for Discord: https://argos-ci.com/discord