nextjs - 💡(How to fix) Fix Can't start dev project in the vscode's js debug terminal with bun [1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#88736Fetched 2026-04-08 02:04:02
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3issue_type_added ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 24.7.0
  npm: 11.5.1
  Yarn: 1.22.21
  pnpm: 10.2.1
  bun: 1.3.6
Relevant Packages:
  next: 16.1.0
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: standalone

---

child = (0, _child_process.fork)(startServerPath, {
                stdio: 'inherit',
                env: {
                    ...defaultEnv,
                    ...bundler === _bundler.Bundler.Turbopack ? {
                        TURBOPACK: process.env.TURBOPACK
                    } : undefined,
                    NEXT_PRIVATE_WORKER: '1',
                    NEXT_PRIVATE_TRACE_ID: _shared.traceId,
                    NODE_EXTRA_CA_CERTS: startServerOptions.selfSignedCertificate ? startServerOptions.selfSignedCertificate.rootCA : defaultEnv.NODE_EXTRA_CA_CERTS,
                    NODE_OPTIONS: (0, _utils.formatNodeOptions)(nodeOptions),
                    // There is a node.js bug on MacOS which causes closing file watchers to be really slow.
                    // This limits the number of watchers to mitigate the issue.
                    // https://github.com/nodejs/node/issues/29949
                    WATCHPACK_WATCHER_LIMIT: _os.default.platform() === 'darwin' ? '20' : undefined
                }
            });
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Aokoooooo/dev-bun-next

To Reproduce

  1. use [email protected], and run bun install to install deps
  2. run bun run dev in the vscode's JS debug terminal
  3. can't start the project(stuck)

Current vs. Expected behavior

It should start the dev project in the JS debug terminal as it could work well in the normal terminal

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 24.7.0
  npm: 11.5.1
  Yarn: 1.22.21
  pnpm: 10.2.1
  bun: 1.3.6
Relevant Packages:
  next: 16.1.0
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: standalone

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

Instrumentation, create-next-app, Module Resolution

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

next dev (local)

Additional context

I checked the code where got the stuck. Hope it could help.

In the next/dist/cli/next-dev, it forked a process and run next/dist/server/lib/start-server

            child = (0, _child_process.fork)(startServerPath, {
                stdio: 'inherit',
                env: {
                    ...defaultEnv,
                    ...bundler === _bundler.Bundler.Turbopack ? {
                        TURBOPACK: process.env.TURBOPACK
                    } : undefined,
                    NEXT_PRIVATE_WORKER: '1',
                    NEXT_PRIVATE_TRACE_ID: _shared.traceId,
                    NODE_EXTRA_CA_CERTS: startServerOptions.selfSignedCertificate ? startServerOptions.selfSignedCertificate.rootCA : defaultEnv.NODE_EXTRA_CA_CERTS,
                    NODE_OPTIONS: (0, _utils.formatNodeOptions)(nodeOptions),
                    // There is a node.js bug on MacOS which causes closing file watchers to be really slow.
                    // This limits the number of watchers to mitigate the issue.
                    // https://github.com/nodejs/node/issues/29949
                    WATCHPACK_WATCHER_LIMIT: _os.default.platform() === 'darwin' ? '20' : undefined
                }
            });

but if I use the bun in the JS debug terminal the file 'start-server ' didn't load as I expected

extent analysis

TL;DR

The issue can be resolved by adjusting the stdio option in the child_process.fork call to handle the differences in terminal behavior between the JS debug terminal and the normal terminal.

Guidance

  • Investigate the child_process.fork options, specifically the stdio option, to ensure it is correctly configured for the JS debug terminal.
  • Verify that the startServerPath is being executed correctly in the JS debug terminal by adding logging or debugging statements.
  • Check the environment variables being passed to the child process, such as NODE_OPTIONS and WATCHPACK_WATCHER_LIMIT, to ensure they are compatible with the JS debug terminal.
  • Consider using a different terminal or debugging tool to isolate the issue and determine if it is specific to the JS debug terminal.

Example

child = (0, _child_process.fork)(startServerPath, {
  stdio: ['inherit', 'inherit', 'inherit', 'ipc'], // Adjust stdio option
  // ...
});

Notes

The issue seems to be related to the differences in terminal behavior between the JS debug terminal and the normal terminal. The child_process.fork call may need to be adjusted to accommodate these differences.

Recommendation

Apply workaround: Adjust the stdio option in the child_process.fork call to handle the differences in terminal behavior. This may require additional debugging and testing to determine the correct configuration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Can't start dev project in the vscode's js debug terminal with bun [1 participants]