'Ember app error - Could not find module `undefined/app` imported from `(require)`

I'm able to start my ember app but nothing loads in the screen and I noticed this error in browser console log. Any idea about what could I be missing?

ember serve

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)

and this is the console error

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


Solution 1:[1]

Broken imports are really hard to find in Ember. You'll get a generic message like the one you received, with little-to-no guidance on where to find the problem.

When I'm in this situation, here are a few things I'll do to isolate the problem:

  1. Reload the app with "Pause on caught exceptions" checked in the debugger. Sometimes you'll find the culprit code, or at least find a place that you can follow up the stack to its source. (You'll have to skip over a bunch of junk exceptions.)
  2. Add template logs {{log "this route works")) in your templates, starting with the outermost / topmost template in the tree of templates / routes. Templates that log correctly are probably not the problem, so at least you know where not to look.

Good luck finding the source. Love to know if anyone has found any better solutions for this problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Kerr