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

BUG: running next build twice with 'mode: standalone' causes build error (Windows Only) #75560

Open
pippinmole opened this issue Feb 1, 2025 · 0 comments
Labels
Module Resolution Module resolution (CJS / ESM, module resolving). Output Related to the the output configuration option.

Comments

@pippinmole
Copy link

Link to the code that reproduces this issue

https://github.com/pippinmole/nextjs-broken-repo

To Reproduce

  1. Make sure you're on a Windows machine
  2. Create a fresh repository with npx create-next-app -e with-docker (or any repository with mode: standalone defined in next.config.ts)
  3. cd [app-name]
  4. Run pnpm install
  5. Run pnpm run build
  6. Wait for successful output
  7. Run pnpm run build again
  8. Experience error

Current vs. Expected behavior

Current Behavior

Receive the following error on 2nd build:

> @ build C:\Users\icond\Downloads\my-app
> next build

   ▲ Next.js 15.2.0-canary.33


> Build error occurred
[Error: Cannot find module '../lib/verify-typescript-setup'
Require stack:
- C:\Users\icond\Downloads\my-app\node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\dist\build\type-check.js
- C:\Users\icond\Downloads\my-app\node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\dist\build\index.js
- C:\Users\icond\Downloads\my-app\node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\dist\cli\next-build.js] {
  code: 'MODULE_NOT_FOUND',
  requireStack: [Array]
}
 ELIFECYCLE  Command failed with exit code 1.

Provide environment information

Node.js v20.18.2

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 64629
  Available CPU cores: 16
Binaries:
  Node: 20.18.2
  npm: 10.9.1
  Yarn: N/A
  pnpm: 9.0.0
Relevant Packages:
  next: 15.2.0-canary.33 // Latest available version is detected (15.2.0-canary.33).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: N/A
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Module Resolution, create-next-app

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

I've tested on both latest and canary, and on multiple windows machines.

@github-actions github-actions bot added create-next-app Related to our CLI tool for quickly starting a new Next.js application. Module Resolution Module resolution (CJS / ESM, module resolving). labels Feb 1, 2025
@samcx samcx added Output Related to the the output configuration option. and removed create-next-app Related to our CLI tool for quickly starting a new Next.js application. labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module Resolution Module resolution (CJS / ESM, module resolving). Output Related to the the output configuration option.
Projects
None yet
Development

No branches or pull requests

2 participants