Repository: next.js
Issue: After upgrading to Next15, the custom server cannot be started in the production environment
Labels: examples

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:57 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.21
  pnpm: N/A
Relevant Packages:
  next: 15.0.4-canary.32
  eslint-config-next: 15.0.3
  react: 19.0.0-rc-fb9a90fa48-20240614
  react-dom: 19.0.0-rc-fb9a90fa48-20240614
  typescript: 5.7.2
Next.js Config:
  output: N/A
```


### Which example does this report relate to?

https://github.com/vercel/next.js/tree/canary/examples/with-mobx

### What browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

Other platform

### Describe the Bug

Here are the errors on the console when I start the custom server：
```
  #  node[57308]: void node::SetupHooks(const FunctionCallbackInfo<v8::Value> &) at ../src/async_wrap.cc:164
  #  Assertion failed: env->async_hooks_init_function().IsEmpty()

----- Native stack trace -----

 1: 0x1000f159c node::Abort() [/usr/local/bin/node]
 2: 0x1000f12ec node::PrintCaughtException(v8::Isolate*, v8::Local<v8::Context>, v8::TryCatch const&) [/usr/local/bin/node]
 3: 0x100032c24 node::SetupHooks(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 4: 0x1002e4494 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) [/usr/local/bin/node]
 5: 0x1002e3b8c v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
 6: 0x100b6cb24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
 7: 0x100ae43e4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
 8: 0x100ae1708 construct_stub_create_deopt_addr [/usr/local/bin/node]
 9: 0x100c205cc Builtins_ConstructHandler [/usr/local/bin/node]
10: 0x100ae43e4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
11: 0x10602c078 
12: 0x100ae43e4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
13: 0x10602c078 
14: 0x100ae43e4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
15: 0x100b1b210 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
16: 0x100bc8fb8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
17: 0x100b0ab94 Builtins_RunMicrotasks [/usr/local/bin/node]
18: 0x100ae23f4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
19: 0x1003b84d0 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
20: 0x1003b89bc v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
21: 0x1003b8b98 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/usr/local/bin/node]
22: 0x1003dfd64 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
23: 0x1003e0500 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
24: 0x100020c64 node::InternalCallbackScope::Close() [/usr/local/bin/node]
25: 0x1000207c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
26: 0x1000f559c node::fs::FileHandle::CloseReq::Resolve() [/usr/local/bin/node]
27: 0x10010ecdc node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/usr/local/bin/node]
28: 0x1000ec4e8 node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/usr/local/bin/node]
29: 0x100abe39c uv__work_done [/usr/local/bin/node]
30: 0x100ac1dec uv__async_io [/usr/local/bin/node]
31: 0x100ad3ec4 uv__io_poll [/usr/local/bin/node]
32: 0x100ac23b0 uv_run [/usr/local/bin/node]
33: 0x100021754 node::SpinEventLoopInternal(node::Environment*) [/usr/local/bin/node]
34: 0x100131c6c node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/usr/local/bin/node]
35: 0x100131a08 node::NodeMainInstance::Run() [/usr/local/bin/node]
36: 0x1000bb718 node::Start(int, char**) [/usr/local/bin/node]
37: 0x189209058 start [/usr/lib/dyld]

----- JavaScript stack trace -----

1: l (/Users/hujimin/tt-web-site-application/build/trip/server/chunks/446.js:1:942945)
2: 10053 (/Users/hujimin/tt-web-site-application/build/trip/server/chunks/446.js:1:944017)
3: t (/Users/hujimin/tt-web-site-application/build/trip/server/webpack-runtime.js:1:143)
4: 1792 (/Users/hujimin/tt-web-site-application/build/trip/server/chunks/446.js:1:956702)
5: t (/Users/hujimin/tt-web-site-application/build/trip/server/webpack-runtime.js:1:143)
6: /Users/hujimin/tt-web-site-application/node_modules/next/dist/server/next-server.js:464:31


[1]    57295 abort      sudo npm run start
```
I found the source code related to node_modules/next/dist/server/next server. js: 464:31 as follows：

<img width="644" alt="image" src="https://github.com/user-attachments/assets/5003d7c1-ca42-42e0-be4f-0b5f1eb11b4c">

The unstable_preloadEntries method is called in the constructor of NextNodeServer：

<img width="703" alt="image" src="https://github.com/user-attachments/assets/ad0a2095-096a-4423-bc5c-d98695d2d7fb">

### Expected Behavior

The application can start normally in the production environment

### To Reproduce

My custom server code : 
```javascript
// server/index.js
const next = require('next');
const _path = require('path');
const express = require('express');

const distDir = 'build/trip'
distDir = _path.join('../', distDir);
const next_app = next({
  dev: false,
  distDir,
})

const start = async () => {
  await next_app.prepare()
  server.listen(8080, () => {})
}

start()
```
My build command：
```bash
next build
```
My startup command：
```bash
server/index.js
```