Skip to content

Can't start dev project in the vscode's js debug terminal with bun #88736

@Aokoooooo

Description

@Aokoooooo

Link to the code that reproduces this issue

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

To Reproduce

  1. use bun@1.3.x, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    InstrumentationRelated to Next.js Instrumentation.Module ResolutionModule resolution (CJS / ESM, module resolving).create-next-appRelated to our CLI tool for quickly starting a new Next.js application.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions