demarches-simplifiees / ds-api-client

MIT License
1 stars 0 forks source link

Sharp on arm64 architecture #1

Closed mfo closed 9 months ago

mfo commented 9 months ago

j'ai voulu testé.

➜  ds-api-client git:(main) ✗ bun ds dossier 13161221 --json
$ bun src/command.ts dossier 13161221 --json
[0.02ms] ".env"
32 |     if (loadedModule) {
33 |       const [, loadedPackage] = loadedModule.match(/node_modules[\\/]([^\\/]+)[\\/]/);
34 |       help.push(`- Ensure the version of sharp aligns with the ${loadedPackage} package: "npm ls sharp"`);
35 |     }
36 |   }
37 |   throw new Error(help.join('\n'));
            ^
error: 
Something went wrong installing the "sharp" module

Cannot find module "../build/Release/sharp-darwin-arm64v8.node" from "/Users/mfo/dev/ds-api-client/node_modules/sharp/lib/sharp.js"

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current darwin-arm64v8 runtime: "npm install --platform=darwin --arch=arm64v8 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
      at /Users/mfo/dev/ds-api-client/node_modules/sharp/lib/sharp.js:37:8
      at globalThis (/Users/mfo/dev/ds-api-client/node_modules/sharp/lib/sharp.js:37:33)
      at require (:1:20)
      at /Users/mfo/dev/ds-api-client/node_modules/sharp/lib/constructor.js:11:0
      at globalThis (/Users/mfo/dev/ds-api-client/node_modules/sharp/lib/constructor.js:439:17)
      at require (:1:20)
      at /Users/mfo/dev/ds-api-client/node_modules/sharp/lib/index.js:6:6
      at globalThis (/Users/mfo/dev/ds-api-client/node_modules/sharp/lib/index.js:16:17)
error: script "ds" exited with code 1 (SIGHUP)

Apres quelques recherches : https://github.com/lovell/sharp/issues/3683, J'imagine que c'est lié a l'archi de mon laptop (m2, pas du x64 mais du arm64).

Donc solution :

➜  ds-api-client git:(main) ✗ npm install --platform=darwin --arch=x64 sharp

up to date, audited 231 packages in 804ms

133 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  ds-api-client git:(main) ✗ npm rebuild --platform=darwin --arch=arm64 sharp
rebuilt dependencies successfully

Bref, maintenant ça passe

➜  ds-api-client git:(main) ✗ bun ds dossier XXXXX --json                  
$ bun src/command.ts dossier 13161221 --json
[0.03ms] ".env"
[
  {
    message: "Dossier not found",
    locations: [
      {
        line: 194,
        column: 5
      }
    ],
    path: [ "dossier" ],
    extensions: {
      code: "not_found"
    }
  }
]
tchak commented 9 months ago

T'a bien lancé bun sharp:install ? Dans tout les cas ça sera corrigé cette semaine dans bun.

mfo commented 9 months ago

oui. il m'a installé le sharp-darwin-x64.node (au lieu de sharp-darwin-arm64v8.node). top si se sera corriger d'ici peu