next.js: Missing node_modules in standalone output
Link to the code that reproduces this issue
https://github.com/noreiller/next-missing-modules-in-standalone-pages
To Reproduce
- Run
npm i
- Run
npm i next@13.5.4-canary.4
- Run
npm run build
- See that the directory
.next/standalone/node_modules/@kontent-ai/delivery-sdk/dist/cjs/mappers
only contains theindex.js
file.
Current vs. Expected behavior
Starting from v13.5.4-canary.4, the directory .next/standalone/node_modules/@kontent-ai/delivery-sdk/dist/cjs/mappers
only contains the index.js
file while previously it contained all the required modules used in the index.js
file.
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2
Binaries:
Node: 18.12.1
npm: 8.19.2
Yarn: 1.22.19
pnpm: 8.2.0
Relevant Packages:
next: 13.5.4
eslint-config-next: 13.5.4
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Standalone mode (output: “standalone”)
Additional context
In node_modules
:
In .next/standalone/node_modules
:
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 19
- Comments: 21 (4 by maintainers)
Commits related to this issue
- build: trying to downgrade next to fix vercel deploy issue related: https://github.com/i18next/next-i18next/issues/2214 https://github.com/vercel/next.js/issues/56357 — committed to pietrobondioli/mywebsite-nextjs by pietrobondioli 9 months ago
- build: trying to downgrade next to fix vercel deploy issue related: https://github.com/i18next/next-i18next/issues/2214 https://github.com/vercel/next.js/issues/56357 — committed to pietrobondioli/mywebsite-nextjs by pietrobondioli 9 months ago
- Fix trace ignore handling (#56674) This ensures we separate our ignore handling for next-server runtime entries and `.next/server` chunks. When these were combined our ignores caused modules that sho... — committed to vercel/next.js by ijjk 9 months ago
- 🐛 nextjs 13.5.4 버전 버그 대응 https://github.com/vercel/next.js/pull/56048/files#r1345651964 https://github.com/vercel/next.js/issues/56607 https://github.com/vercel/next.js/issues/56357 — committed to winterlood/winterlood.com by winterlood 9 months ago
- Downgrade next https://github.com/vercel/next.js/issues/56357 — committed to 0916dhkim/bingo by 0916dhkim 9 months ago
+1 Faced the same issue with
next-i18next
package.To reproduce:
docker build -t next-example -f Dockerfile .
docker run -p 3000:3000 -d next-example
http://localhost:3000/
Actual result: 500 Internal Server Error in browser
Error in docker logs
Related but on next-i18next repo https://github.com/i18next/next-i18next/issues/2214 In that package the problem happens when using getServerSideProps and serverSideTranslations the pages with getStaticProps and serverSideTranslations works fine. Running build locally works fine only fails on vercel reporting missing module Error: Cannot find module ‘core-js/modules/es.array.map.js’
Appears to be working in
next@13.5.5
Can confirm. I had to downgraade to
yarn add -E next@13.5.3
I am having the same issue. In dev (local) mode works fine, but when deployed to Vercel gives the 505 error. I had:
Removing the
^
in the Next dependency worked.Getting the same with sharp on 13.5.4 deployed on Vercel.
Error: Cannot find module 'sharp'
Edit: Downgrading to 13.5.3 fixed the issue. This only happened on pages using Plaiceholder. I had sharp installed via
npm install sharp
, but still was having issues. Is this an issue with packages included with Next by default? If I’m not mistaken, Next automatically includes sharp correct? Is there some conflicting issues with packages that depend on these packages included by Next? I.E. Plaiceholder depends on sharp and can’t seem to find it.Issue seems to come from #56048
Next 13.5.6 came out but seems a shame there was no reactivity on this issue or at least a word!
This Issue has not been stable released but has been fixed in canary. We need to wait for
next@13.5.5
ornext@13.6.0
.Still getting the issue with sharp on version 13.5.4 only running on vercel. I works correctly on development, but fails on production. Had to downgrade as well to 13.5.3
I get the same error when deploying on the container locally for test
Currently, I have downgraded to nextjs@13.5.3
Error: Cannot find module 'core-js/modules/es.array.map.js'
Same issue - both the dev and build works locally, but when deploying on Vercel: