Ember应用程序错误-找不到从"(require)"导入的模块"undefined/ap



我可以启动我的ember应用程序,但屏幕上没有加载任何内容,我在浏览器控制台日志中注意到了这个错误。你知道我会错过什么吗?

会员服务

WARNING: Node v16.14.2 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
Running without permission to symlink will degrade build performance.
See https://cli.emberjs.com/release/appendix/windows/ for details.
File added: "package.json"
Server restarted.
file changed index.js.map
Build successful (8338ms) – Serving on http://localhost:4200/
Slowest Nodes (totalTime >= 5%)                                                                             | Total (avg)
------------------------------------------------------------------------------------------------------------+---------------------------
Babel: @ember/test-helpers (1)                                                                              | 2631ms
Bundler (1)                                                                                                 | 1011ms
BroccoliRollup (6)                                                                                          | 1008ms (168 ms)
ember-auto-import-analyzer (3)                                                                              | 626ms (208 ms)
Package /assets/vendor.js (1)                                                                               | 569ms

Build successful (566ms) – Serving on http://localhost:4200/
Slowest Nodes (totalTime >= 5%)                                                                             | Total (avg)
------------------------------------------------------------------------------------------------------------+---------------------------
Package /assets/vendor.js (1)                                                                               | 79ms
Concat: Vendor Styles/assets/vendor.css (1)                                                                 | 72ms
Funnel (54)                                                                                                 | 42ms (0 ms)

这是控制台错误

loader.js:247 

Uncaught Error: Could not find module `undefined/app` imported from `(require)`
at missingModule (loader.js:247:1)
at findModule (loader.js:258:1)
at requireModule (loader.js:24:1)
at app-boot.js:3:1

在Ember中很难找到损坏的导入。你会收到一条类似于你收到的信息,几乎没有关于在哪里找到问题的指导。

当我处于这种情况时,我会做一些事情来隔离问题:

  1. 使用";捕捉到异常时暂停";已在调试器中签入。有时你会发现罪魁祸首代码,或者至少找到一个可以跟踪堆栈到其源代码的地方。(您将不得不跳过一堆垃圾异常。(
  2. 在模板中添加模板日志{{log "this route works")),从模板/路由树中最外层/最顶层的模板开始。正确记录的模板可能不是问题所在,所以至少你知道不应该去哪里找

祝你找到来源。很想知道是否有人找到了更好的解决方案。

最新更新