Ensure that you have .env available with the database and payload secret configured, you will need a mongo db running for which you can use a remote DB or the provided docker compose file
Then run yarn dev and try to access localhost:3000/admin.
When running nextjs canary version 7 it will work, however newer version of canary have introduced an optional sharp dependency that does not resolve correctly with these package managers and will not work.
So to be clear, change the package.json dependency to canary.34 for next and it will break after installing dependencies again.
I see this issue happen with yarn v1 and pnpm v8 equally
Current vs. Expected behavior
Current
When accessing /admin I see a sharp missing error
Error: Could not load the "sharp" module using the linux-x64 runtime
Expected
When accessing /admin I expect the admin panel to work
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #202403110203~1714077665~22.04~4c8e9a0 SMP PREEMPT_DYNAMIC Thu A
Available memory (MB): 31782
Available CPU cores: 20
Binaries:
Node: 20.9.0
npm: 10.1.0
Yarn: 1.22.21
pnpm: 8.15.8
Relevant Packages:
next: 14.3.0-canary.7 // There is a newer canary version (14.3.0-canary.34) available, please upgrade!
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
"next": "14.3.0-canary.7" works
"next": "14.3.0-canary.34" does not work
canary.7 did not have sharp listed as a dependency and one of the versions since then has introduced it
Link to the code that reproduces this issue
https://github.com/paulpopus/nextjs-payload-sharp-issue
To Reproduce
Ensure that you have
.env
available with the database and payload secret configured, you will need a mongo db running for which you can use a remote DB or the provided docker compose fileThen run
yarn dev
and try to accesslocalhost:3000/admin
.When running nextjs canary version 7 it will work, however newer version of canary have introduced an optional sharp dependency that does not resolve correctly with these package managers and will not work.
So to be clear, change the
package.json
dependency to canary.34 for next and it will break after installing dependencies again.I see this issue happen with yarn v1 and pnpm v8 equally
Current vs. Expected behavior
Current When accessing
/admin
I see a sharp missing errorExpected When accessing
/admin
I expect the admin panel to workProvide environment information
Which area(s) are affected? (Select all that apply)
Module Resolution, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
"next": "14.3.0-canary.7" works "next": "14.3.0-canary.34" does not work
canary.7 did not have sharp listed as a dependency and one of the versions since then has introduced it