Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load the "sharp" module using the darwin-x64 runtime #6841

Closed
matteo-naif opened this issue Jun 19, 2024 · 2 comments
Closed

Could not load the "sharp" module using the darwin-x64 runtime #6841

matteo-naif opened this issue Jun 19, 2024 · 2 comments
Labels

Comments

@matteo-naif
Copy link

Link to reproduction

No response

Payload Version

3.0.0-beta.52

Node Version

20

Next.js Version

14.3.0-canary.68

Describe the Bug

Everytime I install dependencies with yarn I have this error

Error: Could not load the "sharp" module using the darwin-x64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
    yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=darwin --cpu=x64 sharp
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
    at Object.sharp (/.next/server/app/(app)/(other)/page.js:132:18)
    at __webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at eval (./payload.config.ts:14:63)
    at (rsc)/./payload.config.ts (/.next/server/app/(app)/(other)/page.js:688:1)
    at __webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at eval (_config/utilities/payload.ts:6:73)
    at (rsc)/./src/app/(payload)/_config/utilities/payload.ts (/.next/server/app/(app)/(other)/page.js:1072:1)
    at __webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at eval (_utils/getDocument.util.ts:9:95)
    at (rsc)/./src/app/(app)/_utils/getDocument.util.ts (/.next/server/app/(app)/(other)/page.js:775:1)
    at __webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at eval (_components/common/Footer/index.tsx:7:89)
    at (rsc)/./src/app/(app)/_components/common/Footer/index.tsx (/.next/server/app/(app)/(other)/page.js:732:1)
    at __webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at eval (layout.tsx:8:91)
    at (rsc)/./src/app/(app)/(other)/layout.tsx (/.next/server/app/(app)/(other)/page.js:699:1)
    at Function.__webpack_require__ (/.next/server/webpack-runtime.js:33:43)
    at async Promise.all (index 0)
digest: "1475203100"

and as suggested I fix the problem with the command yarn add sharp --ignore-engines.
This happens everytime I install new dependecies or update old ones.

Reproduction Steps

  1. Run yarn install
  2. Execute the project
  3. The error is displayed
  4. Stop the project execution
  5. Run yarn add sharp --ignore-engines
  6. Execute the project
  7. The project now works

Adapters and Plugins

 "@payloadcms/db-mongodb": "beta",     "@payloadcms/next": "beta",     "@payloadcms/plugin-cloud-storage": "beta",     "@payloadcms/plugin-nested-docs": "beta",     "@payloadcms/plugin-seo": "beta",     "@payloadcms/richtext-lexical": "beta",     "@payloadcms/storage-s3": "beta",     "@payloadcms/ui": "beta",
@matteo-naif matteo-naif added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Jun 19, 2024
@AlessioGr
Copy link
Member

AlessioGr commented Jun 19, 2024

Hey, both next.js and sharp decided to drop support for yarn v1 without the --ignore-engines flag, so we did too. If you decide to use yarn v1 (I cannot recommend it), you will have to always append --ignore-engines or put it in a .yarnrc file like we do in our templates.

See the "breaking changes" section in vercel/next.js#63321 as well as vercel/vercel#11131

@AlessioGr AlessioGr closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jun 19, 2024
@matteo-naif
Copy link
Author

Thanks! I followed this tutorial to migrate the version of yarn and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants