Unexpected value 'undefined' declared by the module 'AppModule'

前端 未结 14 1817
庸人自扰
庸人自扰 2021-02-03 16:53

What is wrong here? I\'m trying to make it work but I get that error in the header. I have included the in the app

相关标签:
14条回答
  • 2021-02-03 17:33

    In my case it was class name diffrent and the name i.e in between { name } exported in app.mdoule.ts was diffrent

    good luck

    0 讨论(0)
  • 2021-02-03 17:34

    This is a very annoying and difficult to understand error. I did a file comparison using Araxis Merge found every file in my two projects were almost identical at first glance. However, after further review I noticed a slight difference in file structure(which I wasn't really looking for at first, rather I was looking for configuration differences) that my second project had generated a js file from one of the ts files.

    As you can see on the left side there is a js file. The right side project showed my node-builder component and ran without error. The right side was what caused the problem.

    Webpack had picked up that Javascript file and tried to package it. Obviously, when Webpack encountered the ts version it transpiled it into a duplicate js file, thus creating a confusing run-time exception.

    t {__zone_symbol__error: Error: Unexpected value 'undefined' declared by the 
    module 'AppModule'
        at t.m (http://localhost:……}
    

    As you can see this problem had nothing to do with configuration as many posts had led me to believe. As stated above your problem may have to do with configuration but in my case it did not.

    0 讨论(0)
提交回复
热议问题