角生成-未捕获的TypeError:无法读取未定义的属性'id' [英] Angular Build - Uncaught TypeError: Cannot read property 'id' of undefined
问题描述
我已经设法将我的角度应用程序开发为开发版本.我还没有将其作为生产版本来完成,因为它给了我一些错误,我只需要测试开发版本即可.
I have managed to build my angular app out as a dev build. I haven't done it as a production build yet as it gives me a few errors and i just need to test the dev build.
开发人员的构建过程可以正常进行,没有任何错误或任何错误.然后,我使用Nginx泊坞窗容器中dist文件夹中的文件来托管文件.
The dev build process goes fine, no errors or anything. I then use the files from the dist folder in a nginx docker container to host the files.
问题是什么都没有显示,只有白页,并且在控制台中我收到一条错误消息,提示未捕获的TypeError:无法读取未定义的属性'id'".下面的完整消息似乎没有指向我所写的任何内容,我花了几个小时在网上进行搜索,但找不到有关此问题的任何信息.
The problem is nothing is displayed but a white page and in the console i get an error saying 'Uncaught TypeError: Cannot read property 'id' of undefined'. The full message below doesn't seem to point to anything i have written and i've spent several hours searching online but can't find anything on this problem.
我尝试了一些不同的操作,例如运行"npx ivy-ngcc"(我手动阅读该文件会编译一些内容).无论如何,我是否可以获得有关该错误的更多详细信息,以查看它是否已完成?
I've tried a few different things such as running 'npx ivy-ngcc' which i read manually compiles some stuff. Is there anyway i can get more details on the error to see if it's something i have done?
更新 因此,我恢复了在main.ts中注释掉的行,如下面的注释中所述.我还按照建议尝试了"ng build --aot",这给了我一系列错误,这些错误似乎都与使用的devextreme组件有关.当我使用来自github的devextreme角启动器项目启动该项目时,我感到很奇怪.
UPDATE So i have restored the line that i commented out in main.ts as mentioned in the comments below. I have also tried 'ng build --aot' as suggested which presents me with a series of errors that all seem to relate to devextreme components that are used. I find this strange as i started the project with the devextreme angular starter project from github.
我收到如下消息:
-
'dx-scroll-view无效的HTML元素'
'dx-scroll-view is not a valid HTML element'
'node_modules/devextreme-angular/ui/drawer.d.ts-错误:出现在 SideNavOuterToolbarModule的NgModule.imports,但无法解析为NgModule类'
'node_modules/devextreme-angular/ui/drawer.d.ts - error: appears in the NgModule.imports of SideNavOuterToolbarModule, but could not be resolved to an NgModule class'
推荐答案
我设法通过在角度编译选项中禁用常春藤来解决该问题.我一完成,它就可以同时构建开发版本和生产版本,并且现在可以在Nginx中完美运行.
I managed to solve the problem by disabling ivy in the angular compilation options. As soon as i did that it worked building both dev and production versions and is now working perfectly within Nginx.
感谢所有提供帮助的人:)
Thanks to everyone who offered help :)
这篇关于角生成-未捕获的TypeError:无法读取未定义的属性'id'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!