kevinmarrec / nuxt-pwa-module

⚠️ DEPRECATED ⚠️ Zero config PWA solution for Nuxt 3
MIT License
339 stars 32 forks source link

A sharp module issue kills Nuxt #97

Closed lynxionxs closed 1 year ago

lynxionxs commented 1 year ago

Nuxt won't start because of sharp in the pwa module

Tried removing node_modules and .nuxt/ reinstalled again, issue persists. Tried npm rebuild --verbose sharp, issue persists Tried npm install sharp --save, issue persists Tried npm install --ignore-scripts=false --foreground-scripts --verbose sharp, issue persists Tried npm install --platform=linux --arch=x64 sharp, issue persists

Linux Mint: 20.3
Node: v16.14.2
Error:

Nuxi 3.2.0                                                            00:16:25
Nuxt 3.2.0 with Nitro 2.2.1                                           00:16:25
                                                                      00:16:27
  > Local:    http://localhost:3300/ 
  > Network:  http://192.168.43.251:3300/

/home/bob/projects/nuxt3app/node_modules/sharp/lib/sharp.js:34
  throw new Error(help.join('\n'));
  ^

Error: 
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-x64.node'
Require stack:
- /home/bob/projects/nuxt3app/node_modules/sharp/lib/sharp.js
- /home/bob/projects/nuxt3app/node_modules/sharp/lib/constructor.js
- /home/bob/projects/nuxt3app/node_modules/sharp/lib/index.js                                                      00:16:25
- /home/bob/projects/nuxt3app/node_modules/@kevinmarrec/nuxt-pwa/lib/generate.cjs

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/home/bob/projects/nuxt3app/node_modules/sharp/lib/sharp.js:34:9)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/bob/projects/nuxt3app/node_modules/sharp/lib/constructor.js:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)

 ERROR  [unhandledRejection] 1                                        00:16:47

 ERROR  Cannot start nuxt:  1                                         00:16:51

 ERROR  (node:22477) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 3)
(Use `node --trace-warnings ...` to show where the warning was created)

ℹ Vite client warmed up in 4617ms                                     00:16:52
kevinmarrec commented 1 year ago

@lynxionxs That's sad :(, have you been able to do some search regarding any sharp issue with your OS/environment ?

The issue you're facing can happen when you're starting Nuxt from a different environment that the ones that installed the dependencies.

lynxionxs commented 1 year ago

@kevinmarrec it seems to be working now. Not sure what i did. Tried many things, sharp module repo solutions too. But it's generating the icons now. Screenshot_2023-03-02_21-54-40

kevinmarrec commented 1 year ago

@lynxionxs Glad to know it finally worked.