Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@eggjs/tegg 相关包升级导致项目无法正常启动,cnpmcore 也无法降级锁 tegg 版本 #640

Open
nxps opened this issue Jan 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@nxps
Copy link

nxps commented Jan 16, 2024

cnpmcore 版本: 3.51.0
tegg 版本: 3.29.0

相关 issue
eggjs/tegg#183

@nxps
Copy link
Author

nxps commented Jan 16, 2024

demo 项目
https://github.com/nxps/cnpmcore-demo

@fengmk2
Copy link
Member

fengmk2 commented Jan 16, 2024

private readonly searchAdapter: SearchAdapter;

这里引入了 searchAdapter

2024-01-16 20:58:47,540 ERROR 48323 framework.EggPrototypeNotFound: Object searchAdapter not found in LOAD_UNIT:cnpmcoreRepository [ https://eggjs.org/zh-cn/faq/TEGG_EGG_PROTO_NOT_FOUND ]
    at EggPrototypeFactory.getPrototype (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/factory/EggPrototypeFactory.ts:45:48)
    at EggPrototypeBuilder.tryFindDefaultPrototype (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:67:41)
    at EggPrototypeBuilder.findInjectObjectPrototype (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:97:19)
    at EggPrototypeBuilder.build (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:117:26)
    at create (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/impl/EggPrototypeBuilder.ts:62:20)
    at Function.createProto (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/factory/EggPrototypeCreatorFactory.ts:48:21)
    at ModuleLoadUnit.init (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/impl/ModuleLoadUnit.ts:184:55)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Function.createLoadUnit (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-metadata/src/factory/LoadUnitFactory.ts:33:7)
    at async EggModuleLoader.loadModule (/private/tmp/cnpmcore-demo/node_modules/.store/@[email protected]/node_modules/@eggjs/tegg-plugin/lib/EggModuleLoader.ts:44:24)
code: TEGG_EGG_PROTO_NOT_FOUND
serialNumber: EGG_PROTO_NOT_FOUND
errorContext: ""
pid: 48323

@fengmk2 fengmk2 added the bug Something isn't working label Jan 16, 2024
@killagu
Copy link
Contributor

killagu commented Jan 16, 2024

https://github.com/nxps/cnpmcore-demo/blob/main/config/module.json#L6 这里的 infra 模块没提供 SearchAdapter 的实现了。如果你没有相关的基础设施可以给一个空实现的。

@nxps
Copy link
Author

nxps commented Jan 17, 2024

https://github.com/nxps/cnpmcore-demo/blob/main/config/module.json#L6 这里的 infra 模块没提供 SearchAdapter 的实现了。如果你没有相关的基础设施可以给一个空实现的。

已修复,抱歉没有仔细看 cnpmcore 发布版本日志,看错误直观感受是 tegg 导致的

@nxps
Copy link
Author

nxps commented Jan 17, 2024

还有一个问题,固定版本后运行报错。在半年前,我记得是用当时最新版本(tegg v3.12.0, cnpmcore v3.38.2)开发的,运行正常。

package.json 如下:

    "@eggjs/tegg": "3.12.0",
    "@eggjs/tegg-aop-plugin": "3.12.0",
    "@eggjs/tegg-config": "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",
    "cnpmcore": "3.38.2",

启动错误如下:

nodejs.ERR_PACKAGE_PATH_NOT_EXPORTEDError: [egg-core] load file: /Users/nxps/github/cnpmcore-demo/node_modules/@eggjs/tegg-orm-plugin/app.js, error: Package subpath './src/setup_hooks' is not defined by "exports" in /Users/nxps/github/cnpmcore-demo/node_modules/leoric/package.json

@hezhengxu2018
Copy link
Collaborator

看着像依赖间版本的问题。固定版本不是适合这个项目的开发方式。package.json不会指明实际依赖所需的最低版本,所以如果更新了代码需要删除lock文件重新安装。我觉得和我曾经碰到的 #382 是类似的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants