装完包后启动时报错:framework.MultiPrototypeFound: multi proto found for name:nfsClient and qualifiers
vimplus opened this issue · 4 comments
vimplus commented
~/WebRefer/cnpmcore npm run dev
> cnpmcore@3.37.1 dev
> egg-bin dev
2023-07-13 19:23:16,871 INFO 64280 [master] node version v18.16.0
2023-07-13 19:23:16,872 INFO 64280 [master] egg version 3.16.0
2023-07-13 19:23:19,695 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/ChangesStreamWorker.js
2023-07-13 19:23:19,696 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/ChangesStreamWorker.ts
2023-07-13 19:23:19,696 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CheckRecentlyUpdatedPackages.js
2023-07-13 19:23:19,696 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CheckRecentlyUpdatedPackages.ts
2023-07-13 19:23:19,696 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CleanTempDir.js
2023-07-13 19:23:19,697 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CleanTempDir.ts
2023-07-13 19:23:19,697 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CreateSyncBinaryTask.js
2023-07-13 19:23:19,697 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CreateSyncBinaryTask.ts
2023-07-13 19:23:19,698 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CreateTriggerHookWorker.js
2023-07-13 19:23:19,698 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/CreateTriggerHookWorker.ts
2023-07-13 19:23:19,698 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SavePackageVersionDownloadCounter.js
2023-07-13 19:23:19,698 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SavePackageVersionDownloadCounter.ts
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SyncBinaryWorker.js
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SyncBinaryWorker.ts
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SyncPackageWorker.js
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/SyncPackageWorker.ts
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/TaskTimeoutHandler.js
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/TaskTimeoutHandler.ts
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/TriggerHookWorker.js
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/TriggerHookWorker.ts
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/UpdateTotalData.js
2023-07-13 19:23:19,703 INFO 64281 [egg-schedule]: register schedule /Users/jack/WebRefer/cnpmcore/app/port/schedule/UpdateTotalData.ts
2023-07-13 19:23:19,919 INFO 64280 [master] agent_worker#1:64281 started (3046ms)
2023-07-13 19:23:22,730 ERROR 64418 framework.MultiPrototypeFound: multi proto found for name:nfsClient and qualifiers [{"value":"SINGLETON"}] [ https://eggjs.org/zh-cn/faq/TEGG_MULTI_PROTO_FOUND ]
at EggPrototypeFactory.getPrototype (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/factory/EggPrototypeFactory.ts:50:46)
at EggPrototypeBuilder.tryFindSelfInitTypePrototype (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:89:41)
at EggPrototypeBuilder.findInjectObjectPrototype (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:108:17)
at EggPrototypeBuilder.build (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:115:26)
at create (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:60:20)
at Function.createProto (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/factory/EggPrototypeCreatorFactory.ts:28:19)
at ModuleLoadUnit.init (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/impl/ModuleLoadUnit.ts:168:54)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Function.createLoadUnit (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-metadata/src/factory/LoadUnitFactory.ts:33:7)
at async EggModuleLoader.loadModule (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-plugin/lib/EggModuleLoader.ts:65:24)
code: TEGG_MULTI_PROTO_FOUND
serialNumber: MULTI_PROTO_FOUND
errorContext: ""
pid: 64418
hostname: jackdeMac-mini.local
...(省略四段和上面一样的)
2023-07-13 19:23:22,741 ERROR 64418 [app_worker] beforeExit fail, error: can not get proto for clazz ChangesStreamService
2023-07-13 19:23:22,753 WARN 64281 [ClusterClient:Connection] socket is closed by other side while there were still unhandled data in the socket buffer
[2023-07-13 19:23:22.753] [cfork:master:64280] worker:64418 disconnect (exitedAfterDisconnect: false, state: disconnected, isDead: false, worker.disableRefork: true)
[2023-07-13 19:23:22.753] [cfork:master:64280] don't fork, because worker:64418 will be kill soon
2023-07-13 19:23:22,753 INFO 64280 [master] app_worker#1:64418 disconnect, suicide: false, state: disconnected, current workers: ["1"]
[2023-07-13 19:23:22.753] [cfork:master:64280] worker:64418 exit (code: 0, exitedAfterDisconnect: false, state: dead, isDead: true, isExpected: false, worker.disableRefork: true)
2023-07-13 19:23:22,756 ERROR 64280 nodejs.AppWorkerDiedError: [master] app_worker#1:64418 died (code: undefined, signal: null, suicide: false, state: dead), current workers: [64418]
at Master.onAppExit (/Users/adm/WebRefer/cnpmcore/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 (/Users/jack/WebRefer/cnpmcore/node_modules/egg-cluster/lib/utils/messenger.js:137:17)
at Messenger.send (/Users/jack/WebRefer/cnpmcore/node_modules/egg-cluster/lib/utils/messenger.js:102:12)
at EventEmitter.<anonymous> (/Users/jack/WebRefer/cnpmcore/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: 64280
hostname: jackdeMac-mini.local
2023-07-13 19:23:22,756 ERROR 64280 [master] app_worker#1:64418 start fail, exiting with code:1
2023-07-13 19:23:22,756 ERROR 64280 [master] exit with code:1
2023-07-13 19:23:22,762 ERROR 64281 [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110
2023-07-13 19:23:22,763 ERROR 64281 [agent_worker] exit with code:110
ForkError: /Users/jack/WebRefer/cnpmcore/node_modules/egg-bin/scripts/start-cluster.js {"baseDir":"/Users/jack/WebRefer/cnpmcore","workers":1,"port":7001,"framework":"/Users/jack/WebRefer/cnpmcore/node_modules/egg","typescript":true,"tscompiler":"ts-node/register","sticky":false} exit with code 1
at ChildProcess.<anonymous> (/Users/jack/WebRefer/cnpmcore/node_modules/egg-bin/src/cmd/base.ts:117: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
}
运行环境
- 系统:Mac 11.6 (M1)
- Node版本:v18.16.0
- MySQL:8.0.31 (已按网上的操作修改加密方式并已启动)
- Redis 信息:Redis server v=6.2.2 sha=00000000:0 malloc=libc bits=64 build=82227441e0d7b397 (已启动)
问题描述
运行 npm run dev
后报以上错误
github-actions commented
我们已经看到你的反馈,如果是功能缺陷,可以提供一下重现该问题的方式;如果是新功能需求,我们会尽快加入讨论。同时我们非常期待你可以加入我们的贡献者行列,让项目可以长期可持续发展。
fengmk2 commented
你应该是运行了一次 tsc 编译,先 npm run clean 清空编译的 js 文件。
vimplus commented
你应该是运行了一次 tsc 编译,先 npm run clean 清空编译的 js 文件。
清理完运行 npm run dev
会出现这个报错(除了数据库配置没改其他代码):
2023-07-14 10:21:09,597 ERROR 34536 nodejs.Error: ctx is required
at /Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/model/AbstractEggContext.ts:101:11
at Function.getContainer (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/factory/EggContainerFactory.ts:23:12)
at Function.getEggObject (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/factory/EggContainerFactory.ts:44:28)
at NFSClientAdapter.get [as logger] (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/impl/EggObjectUtil.ts:21:49)
at NFSClientAdapter.init (/Users/jack/WebRefer/cnpmcore/app/infra/NFSClientAdapter.ts:42:12)
at EggObjectImpl.init (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/impl/EggObjectImpl.ts:71:43)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createObject (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/impl/EggObjectImpl.ts:117:5)
at async Function.createObject (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/factory/EggObjectFactory.ts:41:17)
at async ModuleLoadUnitInstance.getOrCreateEggObject (/Users/jack/WebRefer/cnpmcore/node_modules/@eggjs/tegg-runtime/src/impl/ModuleLoadUnitInstance.ts:77:21)
pid: 34536
hostname: jackdeMac-mini.local
这个也是运行 tsc 编译之前一直困恼的报错,没找到原因,帮忙看看,谢谢!
vimplus commented
终于解决了!!!
M1 的 Mac 需要把这几个包安装 3.12.0 以上:
"@eggjs/tegg": "^3.12.0",
"@eggjs/tegg-aop-plugin": "^3.12.0",
"@eggjs/tegg-controller-plugin": "^3.12.0",
"@eggjs/tegg-eventbus-plugin": "^3.12.0",
"@eggjs/tegg-orm-plugin": "^3.12.0",
"@eggjs/tegg-plugin": "^3.12.0",
"@eggjs/tegg-schedule-plugin": "^3.12.0",
如果不想更新到最新,最低要求是将这些包更新 3.5.2
版本,不然运行 npm run dev
时则会
报诸如下面以及上面 nodejs.Error: ctx is required
这样等各种奇怪的错误:
2023-07-14 10:48:06,794 ERROR 3847 nodejs.TSError: [tegg/loader] load /Users/jack/WorkSpace/wnpmcore/app/infra/NFSClientAdapter.ts failed: ⨯ Unable to compile TypeScript:
app/infra/NFSClientAdapter.ts:3:3 - error TS2305: Module '"@eggjs/tegg"' has no exported member 'LifecycleInit'.
3 LifecycleInit,
~~~~~~~~~~~~~
app/infra/NFSClientAdapter.ts:3:3 - error TS2305: Module '"@eggjs/tegg"' has no exported member 'LifecycleInit'.
3 LifecycleInit,
~~~~~~~~~~~~~
at createTSError (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.require.extensions.<computed> [as .ts] (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
diagnosticCodes: [2305]
pid: 3847
hostname: jackdeMac-mini.local
/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: [tegg/loader] load /Users/jack/WorkSpace/wnpmcore/app/infra/NFSClientAdapter.ts failed: ⨯ Unable to compile TypeScript:
app/infra/NFSClientAdapter.ts:3:3 - error TS2305: Module '"@eggjs/tegg"' has no exported member 'LifecycleInit'.
3 LifecycleInit,
~~~~~~~~~~~~~
at createTSError (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.require.extensions.<computed> [as .ts] (/Users/jack/WorkSpace/wnpmcore/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19) {
diagnosticCodes: [ 2305 ]
}
2023-07-14 10:48:06,809 ERROR 3842 nodejs.AgentWorkerDiedError: [master] agent_worker#1:3847 died (code: 1, signal: null)
at Master.onAgentExit (/Users/jack/WorkSpace/wnpmcore/node_modules/egg-cluster/lib/master.js:316:17)
at Master.emit (node:events:513:28)
at Master.emit (node:domain:489:12)
at Messenger.sendToMaster (/Users/jack/WorkSpace/wnpmcore/node_modules/egg-cluster/lib/utils/messenger.js:137:17)
at Messenger.send (/Users/jack/WorkSpace/wnpmcore/node_modules/egg-cluster/lib/utils/messenger.js:102:12)
at ChildProcess.<anonymous> (/Users/jack/WorkSpace/wnpmcore/node_modules/egg-cluster/lib/utils/mode/impl/process/agent.js:89:22)
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)
name: "AgentWorkerDiedError"
pid: 3842
hostname: jackdeMac-mini.local
2023-07-14 10:48:06,809 ERROR 3842 [master] agent_worker#1:3847 start fail, exiting with code:1
2023-07-14 10:48:06,809 ERROR 3842 [master] exit with code:1
ForkError: /Users/jack/WorkSpace/wnpmcore/node_modules/egg-bin/scripts/start-cluster.js {"baseDir":"/Users/jack/WorkSpace/wnpmcore","workers":1,"port":7001,"framework":"/Users/jack/WorkSpace/wnpmcore/node_modules/egg","typescript":true,"tscompiler":"ts-node/register","sticky":false} exit with code 1
at ChildProcess.<anonymous> (/Users/jack/WorkSpace/wnpmcore/node_modules/egg-bin/src/cmd/base.ts:117: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
}