kevinmarrec / nuxt-pwa-module

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

Dependency "sharp" cannot be installed in Docker container #101

Closed PatrickMi closed 1 year ago

PatrickMi commented 1 year ago

When starting my Nuxt Project maevsi in Docker using maevsi stack I get an error that the sharp module couldn't be installed. I'm using a 2021 MacBook Pro with the Apple M1 Pro and run the code in a container running the node:20 image. I wanted to open an issue in the sharp repository but it says that one should create an issue on the package using sharp as a dependency first. I hope somebody can help me as Nuxt can't start up with this error. Thanks in advance! 😀

This is the error I get:

Nuxi 3.4.3
Nuxt 3.4.3 with Nitro 2.3.3
  > Local:    http://localhost:3000/ 
  > Network:  http://10.0.3.14:3000/
  > Network:  http://172.18.0.7:3000/
ℹ Using html-validate to validate server-rendered HTML
/srv/app/node_modules/.pnpm/sharp@0.31.3/node_modules/sharp/lib/sharp.js:34
  throw new Error(help.join('\n'));
  ^
Error: 
Something went wrong installing the "sharp" module
libvips-cpp.so.42: cannot open shared object file: No such file or directory
Possible solutions:
 - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
 - Install for the current linux-arm64v8 runtime: "npm install --platform=linux --arch=arm64v8 sharp"
 - Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/srv/app/node_modules/.pnpm/sharp@0.31.3/node_modules/sharp/lib/sharp.js:34:9)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at Module.require (node:internal/modules/cjs/loader:1149:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/srv/app/node_modules/.pnpm/sharp@0.31.3/node_modules/sharp/lib/constructor.js:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
Node.js v20.0.0
 ERROR  [unhandledRejection] 1
 ERROR  Cannot start nuxt:  1
 ERROR  (node:101) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 4)
dargmuesli commented 1 year ago

~The code formatting in the issue description is broken.~

I think deployment using maevsi_stack is irrelevant as noone really knows what that is. A relevant information instead would be which stage of the Dockerfile the error occurs in and if it occurs when building or running it. Also, what did trying the possible solutions you quoted yield?

The error says libvips-cpp.so.42 is missing so you'd need to find out why it's missing and then how to make it reappear. A web search can explain what that file is for and help understand why its missing.

After all, the issue is most likely neither with this project nor sharp but with maevsi (which uses sharp as a transitive dependency). This issue might be able to be closed and reopened for maevsi.

dargmuesli commented 1 year ago

@PatrickMi I think this issue can be closed. What do you think?

PatrickMi commented 1 year ago

I think it can be closed