capacitor-assets icon indicating copy to clipboard operation
capacitor-assets copied to clipboard

npm error sharp: Installation error: aborted

Open dythbj opened this issue 1 year ago • 3 comments

MacOS Sonoma 14.4.1, Apple M3 Pro

sudo npm install -g cordova-res --unsafe-perm=true

npm error code 1 npm error path /usr/local/lib/node_modules/cordova-res/node_modules/sharp npm error command failed npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) npm error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.11.3/libvips-8.11.3-darwin-x64.tar.br npm error sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies npm error sharp: Installation error: aborted

npm error A complete log of this run can be found in...

=========================================

197 silly placeDep node_modules/cordova-res [email protected] OK for: [email protected] want: ^1.3.1 198 silly placeDep node_modules/cordova-res [email protected] OK for: [email protected] want: ^1.1.13 199 silly placeDep node_modules/cordova-res [email protected] OK for: [email protected] want: ^1.1.1 200 silly placeDep node_modules/cordova-res [email protected] OK for: [email protected] want: ^1.0.1 201 silly fetch manifest safe-buffer@~5.2.0 202 silly placeDep node_modules/cordova-res [email protected] OK for: [email protected] want: ~5.2.0 203 silly reify moves {} 204 info run [email protected] install node_modules/cordova-res/node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) 205 info run [email protected] install { code: 1, signal: null } 206 verbose stack Error: command failed 206 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) 206 verbose stack at ChildProcess.emit (node:events:519:28) 206 verbose stack at maybeClose (node:internal/child_process:1105:16) 206 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) 207 verbose pkgid [email protected] 208 verbose cwd /Users/gaojie 209 verbose Darwin 23.4.0 210 verbose node v20.14.0 211 verbose npm v10.7.0 212 error code 1 213 error path /usr/local/lib/node_modules/cordova-res/node_modules/sharp 214 error command failed 215 error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) 216 error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.11.3/libvips-8.11.3-darwin-x64.tar.br 216 error sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies 217 error sharp: Installation error: aborted 218 verbose exit 1 219 verbose code 1 220 silly unfinished npm timer reify 1717158764513

So, Any idea?

dythbj avatar May 31 '24 12:05 dythbj

I'm having the same problem, please fix this

jeroenman avatar Aug 15 '24 13:08 jeroenman

running solved the problem for me: npm install --ignore-scripts=false --foreground-scripts --verbose sharp --force

jeroenman avatar Aug 16 '24 09:08 jeroenman

nothing has fixed it for me, tried installing the latest version using npm i sharp --saveDev, and running npm install --ignore-scripts=false --foreground-scripts --verbose sharp --force and npm install --cpu=arm64v8 --os=darwin sharp and npm install --cpu=arm64 --os=darwin sharp.

Nothing has made npx @capacitor/assets generate succeed on my m4 silicon:

npx @capacitor/assets generate                                                                             
/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/lib/sharp.js:37
  throw new Error(help.join('\n'));
  ^

Error: 
Something went wrong installing the "sharp" module

dlopen(/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node, 0x0001): tried: '/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node' (no such file), '/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

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 Object.<anonymous> (/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/lib/sharp.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/Users/matthewharris/rtp/rtpSoftware/Ionic/BeerBargain/BeerBargainApp/node_modules/@capacitor/assets/node_modules/sharp/lib/constructor.js:11:1)

rtpHarry avatar Apr 20 '25 10:04 rtpHarry