PlayForm / Compress

🗜️ Compress —

Home Page:https://NPMJS.Org/@playform/compress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Something went wrong installing the "sharp" module

lekiq opened this issue · comments

I am using a Macbook Pro with a M2 chip, and I am getting this issue when running npm run dev

/Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/sharp.js:37
  throw new Error(help.join('\n'));
        ^

Error: 
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-darwin-arm64v8.node'
Require stack:
- /Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/sharp.js
- /Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/constructor.js
- /Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/index.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 Object.<anonymous> (/Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/sharp.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/Users/lekiq/opensource/nebulix/node_modules/astro-compress/node_modules/sharp/lib/constructor.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)

Node.js v18.18.2

Yeah, sharp isn't supported on some machines. Maybe check their repo for issues https://github.com/lovell/sharp/issues or I'd recommend using the no-sharp branch https://github.com/astro-community/AstroCompress/tree/no-sharp if you're not using image compression. You can install it like so:

npm install -D -E astro-community/AstroCompress#no-sharp

I'll update it shortly to have the latest changes.

Or maybe I have to ship different versions depending on OS https://sharp.pixelplumbing.com/install#cross-platform I'll check into it further.

@lekiq did you try running

npm install --platform=darwin --arch=arm64v8 sharp