应用无法启动：Cannot read properties of undefined (reading 'app')
### 在此输入你需要反馈的 Bug 具体信息（Bug in Detail）：


```
$ yarn dev:backend
yarn run v1.22.19
$ cd packages/backend && yarn dev
$ egg-bin dev --framework=../../../node_modules/egg
2023-03-13 22:17:55,310 INFO 21464 [master] node version v18.15.0
2023-03-13 22:17:55,311 INFO 21464 [master] egg version 3.15.0
2023-03-13 22:18:00,457 INFO 21464 [master] agent_worker#1:8112 started (5141ms)
Mon, 13 Mar 2023 14:18:05 GMT egg-logger deprecated EggContextLogger is deprecated, use the EggLogger directly at ..\..\node_modules\egg\app\extend\context.js:114:19
2023-03-13 22:18:05,329 ERROR 23832 nodejs.TypeError: Cannot read properties of undefined (reading 'app')
    at new BaseContextClass (D:\site\next-oj\node_modules\egg-core\lib\utils\base_context_class.js:25:20)
    at new BaseContextClass (D:\site\next-oj\node_modules\egg\lib\core\base_context_class.js:13:1)
    at new default_1 (D:\site\next-oj\packages\backend\app\controller\user.ts:11:16)
    at EggPrototypeImpl.constructEggObject (D:\site\next-oj\node_modules\@eggjs\tegg-metadata\src\impl\EggPrototypeImpl.ts:61:20)
    at EggObjectImpl.init (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\EggObjectImpl.ts:31:30)
    at createObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\EggObjectImpl.ts:111:15)
    at Function.createObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\factory\EggObjectFactory.ts:41:31)
    at ModuleLoadUnitInstance.getOrCreateEggObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\ModuleLoadUnitInstance.ts:75:45)
    at ModuleLoadUnitInstance.init (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\ModuleLoadUnitInstance.ts:49:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

pid: 23832
hostname: ABCDHGFE

2023-03-13 22:18:05,331 ERROR 23832 nodejs.TypeError: Cannot read properties of undefined (reading 'app')
    at new BaseContextClass (D:\site\next-oj\node_modules\egg-core\lib\utils\base_context_class.js:25:20)
    at new BaseContextClass (D:\site\next-oj\node_modules\egg\lib\core\base_context_class.js:13:1)
    at new default_1 (D:\site\next-oj\packages\backend\app\controller\user.ts:11:16)
    at EggPrototypeImpl.constructEggObject (D:\site\next-oj\node_modules\@eggjs\tegg-metadata\src\impl\EggPrototypeImpl.ts:61:20)
    at EggObjectImpl.init (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\EggObjectImpl.ts:31:30)
    at createObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\EggObjectImpl.ts:111:15)
    at Function.createObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\factory\EggObjectFactory.ts:41:31)
    at ModuleLoadUnitInstance.getOrCreateEggObject (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\ModuleLoadUnitInstance.ts:75:45)
    at ModuleLoadUnitInstance.init (D:\site\next-oj\node_modules\@eggjs\tegg-runtime\src\impl\ModuleLoadUnitInstance.ts:49:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

pid: 23832
hostname: HZH-PC-3-LTS

2023-03-13 22:18:05,331 ERROR 23832 [app_worker] start error, exiting with code:1
[2023-03-13 22:18:05.332] [cfork:master:21464] worker:23832 disconnect (exitedAfterDisconnect: false, state: disconnected, isDead: false, worker.disableRefork: true)
[2023-03-13 22:18:05.332] [cfork:master:21464] don't fork, because worker:23832 will be kill soon
2023-03-13 22:18:05,333 INFO 21464 [master] app_worker#1:23832 disconnect, suicide: false, state: disconnected, current workers: ["1"]
2023-03-13 22:18:05,340 ERROR 8112 nodejs.unhandledExceptionError: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
errno: -4077
code: "ECONNRESET"
syscall: "read"
name: "unhandledExceptionError"
pid: 8112
hostname: HZH-PC-3-LTS

[2023-03-13 22:18:05.350] [cfork:master:21464] worker:23832 exit (code: 1, exitedAfterDisconnect: false, state: dead, isDead: true, isExpected: false, worker.disableRefork: true)
2023-03-13 22:18:05,355 ERROR 21464 nodejs.AppWorkerDiedError: [master] app_worker#1:23832 died (code: undefined, signal: null, suicide: false, state: dead), current workers: [23832]
    at Master.onAppExit (D:\site\next-oj\node_modules\egg-cluster\lib\master.js:401:21)
    at Master.emit (node:events:513:28)
    at Master.emit (node:domain:489:12)
    at Messenger.sendToMaster (D:\site\next-oj\node_modules\egg-cluster\lib\utils\messenger.js:137:17)
    at Messenger.send (D:\site\next-oj\node_modules\egg-cluster\lib\utils\messenger.js:102:12)
    at EventEmitter.<anonymous> (D:\site\next-oj\node_modules\egg-cluster\lib\utils\mode\impl\process\app.js:114:22)
    at EventEmitter.emit (node:events:525:35)
    at EventEmitter.emit (node:domain:489:12)
    at ChildProcess.<anonymous> (node:internal/cluster/primary:188:13)
    at Object.onceWrapper (node:events:628:26)
name: "AppWorkerDiedError"
pid: 21464
hostname: HZH-PC-3-LTS

2023-03-13 22:18:05,356 ERROR 21464 [master] app_worker#1:23832 start fail, exiting with code:1
2023-03-13 22:18:05,356 ERROR 21464 [master] exit with code:1
ForkError: D:\site\next-oj\node_modules\egg-bin\scripts\start-cluster.js {"baseDir":"D:\\site\\next-oj\\packages\\backend","workers":1,"port":7001,"framework":"D:\\site\\next-oj\\node_modules\\egg","typescript":true,"tscompiler":"ts-node/register","sticky":false} exit with code 1
    at ChildProcess.<anonymous> (D:\site\next-oj\node_modules\egg-bin\src\cmd\base.ts:120:23)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  code: 1
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

### 可复现问题的仓库地址（Reproduction Repo）

很抱歉，由于使用了 lerna 作为多包管理器，不适用于 `npm init egg --type=simple bug` 命令。

[仓库](https://github.com/kaikaibenkai/egg-demo-5155)

运行 `yarn && yarn dev:backend`

### Node 版本号：

18.15.0

### Eggjs 版本号：

3.15.0

### 相关插件名称与版本号（PlugIn and Name）：

None

### 操作平台与版本号（Platform and Version）：

Windows 11 家庭中文版 (22H2)

（Git Bash）