next.js: Error: Cannot find module 'next/dist/compiled/jest-worker' - On Docker
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Error: Cannot find module 'next/dist/compiled/jest-worker'
Require stack:
- /app/node_modules/next/dist/server/lib/squoosh/main.js
- /app/node_modules/next/dist/server/image-optimizer.js
- /app/node_modules/next/dist/server/next-server.js
- /app/server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
at Function.mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at Function.Module._load (node:internal/modules/cjs/loader:871:27)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object.<anonymous> (/app/node_modules/next/dist/server/lib/squoosh/main.js:8:19)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/app/node_modules/next/dist/server/lib/squoosh/main.js',
'/app/node_modules/next/dist/server/image-optimizer.js',
'/app/node_modules/next/dist/server/next-server.js',
'/app/server.js'
]
}
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
https://github.com/Storxy/storxy-business-erp
To Reproduce
Trying to dockerize next application using with docker and the docker file can be found on the repo but it throws an errors when ever I run the containers and visit any page that contain an optimized image while sharp is already been installed and the image not shown
Describe the Bug
images not working in docker apps
Expected Behavior
to show optimized image?
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 48
- Comments: 43 (6 by maintainers)
Commits related to this issue
- downgrade next to 13.2.4 due to lib issue in next https://github.com/vercel/next.js/issues/48173 — committed to Fraser27/nextjs13-ssr-sample by deleted user a year ago
- fix(web): đđŚđ§ downgrade next to support <Image> in standalone ref https://github.com/vercel/next.js/issues/48173 — committed to collinbarrett/FilterLists by collinbarrett a year ago
- [EVT-003] BUG: https://github.com/vercel/next.js/issues/48173 — committed to Tesin/EVT-Challenge by Tesin a year ago
- Evt 003 next image bug (#3) * [EVT-003] BUG: https://github.com/vercel/next.js/issues/48173 * {EVT-003] Update lock file — committed to Tesin/EVT-Challenge by Tesin a year ago
- Downgrade nextjs to 13.2.4 For reference see: https://github.com/vercel/next.js/issues/48173 — committed to Yasamato/bvsr-landing-page by Yasamato a year ago
- Fixed `image-optimizer` crashing when using `outputFileTracing` (#48513) <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible w... — committed to vercel/next.js by DuCanhGH a year ago
- fix: build fix with downgrade nextjs version issue: https://github.com/vercel/next.js/issues/48173 — committed to longway-llc/stock-journal by VadimOnix a year ago
- Downgrade next version to next@13.2.4 due to https://github.com/vercel/next.js/issues/48173 — committed to jessika/bilbo by jessika a year ago
Got same error on nextjs 13.3.0, node:18-alpine
the same issue
next@13.4.7
+output: 'standalone'
@ijjk The README.md says
I think this issue should not be closed until it is fixed for the latest version of nextjs or we should add a version hint to the README. Otherwise users will face this problem not just with existing apps > 13.2.4 but also with new created project through
npx create-next-app@latest
It appears
next@13.4.8
doesnât suffer from the issue, can somebody else confirm this?Downgrade
next
to13.2.4
and it should work fine. It didnât work for me on13.3.0
. Iâve also tried downgradingsharp
but to no avail.It solved after install jest-worker manually
yarn add jest-worker --save-dev
next
13.2.4
didnât work for me, images are not showing up in productionworked for me.
next@13.4.7
andnode:18-alpine
I ran into the exact same problem when I tried adding Docker after creating my app with
npx create-next-app@latest
. The version I had was13.4.4
at the time. Unfortunately,13.2.4
wasnât even an option because of some pesky compatibility issues.My way to make things work was downgrading to version
13.4.0
. Problem solved for now.same problem here, images donât work in production after I upgraded next from 13.1.6 to 13.3.1
same issue 13.3.1-canary.4
Thatâs it so. Avoid odd version, guys đ¤Ą
On Mon, 10 Jul 2023, 22:19 Clark Brown, @.***> wrote:
Had the same issue with loading images on an app hosted with Amplify and downgrading next to
13.2.4
solved it for mesame issue with #48077 and there is a workaround.
Weâve updated
node18-alpine
in Dockerfile, and next v13.2.4, it works for me.