Skip to content
New issue

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

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

Already on GitHub? # to your account

Cannot find module 'next/dist/server/next-server.js'. Turborepo + VercelCLI #48949

Closed
1 task done
MrDockal opened this issue Apr 28, 2023 · 9 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked stale The issue has not seen recent activity.

Comments

@MrDockal
Copy link

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: #76~20.04.1-Ubuntu SMP Mon Mar 20 15:54:19 UTC 2023
    Binaries:
      Node: 16.15.1
      npm: 8.19.1
      Yarn: 1.22.19
      pnpm: 7.29.1
    Relevant packages:
      next: 13.3.1
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0

----------------- 

Vercel CLI 28.20.0
28.20.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Turbopack (--turbo)

Link to the code that reproduces this issue

https://github.com/MrDockal/nextjs-turbo-vercel-cli-issue

To Reproduce

  1. Clone the repo https://github.com/MrDockal/nextjs-turbo-vercel-cli-issue
  2. npx vercel build --token YOUR_VERCEL_TOKEN --cwd apps/web
  3. npx vercel deploy --prebuilt --token YOUR_VERCEL_TOKEN --yes --cwd apps/web
  4. Visit the /lambda page and you'll get 500. The root page / works

Describe the Bug

Hello,
When I deploy a lambda function (page with getServerSideProps implemented) to Vercel using Vercel CLI + Turborepo + NextJs. The lambda throws an error: Cannot find module 'next/dist/server/next-server.js' (it could similar to this issue #39432)
There isn't node_modules folder at all
image

I tried to deploy the same Nextjs app outside the Turborepo and it works. As you see there is node_modules folder with all required dependencies now
image

I don't know if this is an issue with Next, Turborepo or Vercel CLI itself.
Thank you

Expected Behavior

I expect endpoint /lambda to return 200 with HTML code

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@MrDockal MrDockal added the bug Issue was opened via the bug report template. label Apr 28, 2023
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Apr 28, 2023
@padmaia padmaia removed the Turbopack Related to Turbopack with Next.js. label Apr 28, 2023
@padmaia
Copy link
Member

padmaia commented Apr 28, 2023

Removed the Turbopack label since it's related to production builds, which Turbopack does not support yet.

@jakeleventhal
Copy link
Contributor

Related issue: vercel/vercel#8794

@jakeleventhal
Copy link
Contributor

#39432 (reply in thread)
Check this out. Turbo unrelated

@MrDockal
Copy link
Author

MrDockal commented Jun 6, 2023

Right! thank you @jakeleventhal. This is definitely related to https://github.com/trappar/next-vercel-ssr-bug

@joseocabarcas
Copy link

I have the same issue with turborepo and pnpm when deploy with vercel cli prebuilt. The pages with getServerSideProps broken with Cannot find module 'next/dist/server/[next-server](https://linear.app/vercel/issue/NEXT-server).js'
Any solutions or workaround?

@jakeleventhal
Copy link
Contributor

Should close this as a duplicate of vercel/vercel#8794

@nextjs-bot
Copy link
Collaborator

This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

@nextjs-bot nextjs-bot added the stale The issue has not seen recent activity. label Feb 8, 2025
@nextjs-bot
Copy link
Collaborator

This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!

@nextjs-bot nextjs-bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2025
Copy link
Contributor

github-actions bot commented Mar 2, 2025

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Mar 2, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template. locked stale The issue has not seen recent activity.
Projects
None yet
Development

No branches or pull requests

6 participants
@padmaia @MrDockal @joseocabarcas @jakeleventhal @nextjs-bot and others