-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Symbol.for('egg#eggPath') is required on Application #3591
Comments
提供最小可复现仓库 |
Hello @ronesam. Please provide a reproducible example following the instruction. Issues labeled by 如果在 7 天内没有进展会被自动关闭。 |
hey, we need more information to follow up this issue, recommend to use for now it will close due to lack of activity, feel free to reopen this issue if provided more information. |
我也遇上这个问题,经过一番 debug,定位到问题所在,希望对遇到相同场景的人有所帮助。 必现路径
定位问题 🕵️♂️
getEggPaths() {
while (proto) {
proto = Object.getPrototypeOf(proto);
if (proto === Object.prototype || proto === EggCore.prototype) {
break;
}
assert(proto.hasOwnProperty(Symbol.for('egg#eggPath')), 'Symbol.for(\'egg#eggPath\') is required on Application');
...
}
}
function getLoader(baseDir: string, framework: string) {
const frameworkPath = path.join(baseDir, 'node_modules', framework);
//...
const egg = utils.requireFile(frameworkPath) || utils.requireFile(framework);
return new EggLoader({
//...
app: Object.create(egg.Application.prototype),
});
} 在我的 💻 上 问题所在link framework 启动之后,项目使用的
导致最终得到的 EggCore.prototype 不相等(打印出来 proto 确实是 |
目前是会有这个问题,因为 link 过来后导致存在了两个 egg-core ,这个暂时没想到啥解决方案,除非去干涉 require 的行为,就有点 hack 了 |
@whxaxes |
link 之后把你框架下面的 egg-core 删了 |
@popomore 不行吧, |
egg 里面 require 的 egg-core 应该在 egg 项目里面有 |
我删除了
|
+1 |
最后这个问题是如何解决的呢? |
如果只是 link 的时候报错,可以临时修改本地代码先用着: |
可以全局安装egg-core,project和framework里的egg-core都link到全局的那个 |
这个谁pr一下,唉 |
+1 |
1 similar comment
+1 |
这个感觉需要reopen,毕竟对于团队来说,framework 开发是非常有必要的。yarn link的友好支持,肯定对这个更有帮助。 |
+1 |
我也遇到了 |
遇到了+1。用这个判断临时修改下 |
遇到了+1。 |
1 similar comment
遇到了+1。 |
What happens?
业务代码使用TS,引入框架,
npm run dev
告警。复现步骤,错误日志以及相关配置
相关环境信息
The text was updated successfully, but these errors were encountered: