Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度——prod构建失败_Angular_Angular Cli - Fatal编程技术网

Angular 角度——prod构建失败

Angular 角度——prod构建失败,angular,angular-cli,Angular,Angular Cli,我的团队目前正在开发我们的第一个Angular/Angular cli应用程序。当我们的项目使用JIT编译进行构建和工作时,我们遇到了IE 11的性能问题,所以我想了解一下使用AOT时IE的性能(使用--prod参数构建)。不幸的是,构建失败了,由于缺乏经验,我不能完全理解错误,也不能完全理解如何处理它 错误: [ERROR] ERROR in Cannot determine the module for class BaseSopPanelComponent in /Users/brife/

我的团队目前正在开发我们的第一个Angular/Angular cli应用程序。当我们的项目使用JIT编译进行构建和工作时,我们遇到了IE 11的性能问题,所以我想了解一下使用AOT时IE的性能(使用--prod参数构建)。不幸的是,构建失败了,由于缺乏经验,我不能完全理解错误,也不能完全理解如何处理它

错误:

[ERROR] ERROR in Cannot determine the module for class BaseSopPanelComponent in /Users/brife/svn/lms/sop/branches/current/ng2/src/app/components/base-sop-panel/base-sop-panel.component.ts! Add BaseSopPanelComponent to the NgModule to fix it.
[ERROR] ERROR in ./src/main.ts
[ERROR] Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/brife/svn/lms/sop/branches/current/ng2/src'
[ERROR] resolve './$$_gendir/app/app.module.ngfactory' in '/Users/brife/svn/lms/sop/branches/current/ng2/src'
[ERROR]   using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src)
[ERROR]     Field 'browser' doesn't contain a valid alias configuration
[ERROR]   after using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src)
[ERROR]     using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src/$$_gendir/app/app.module.ngfactory)
[ERROR]       no extension
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory doesn't exist
[ERROR]       .ts
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.ts doesn't exist
[ERROR]       .js
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.js doesn't exist
[ERROR]       as directory
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory doesn't exist
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.ts]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.js]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory]

BaseSopPanelComponent是我们的6或7个组件的基类。构造函数签名为:

  constructor(public readonly dataService: SopDataService, public readonly name: string)
在将BaseSopPanelComponent添加到app.modules之后,我得到了错误

[ERROR] ERROR in Can't resolve all parameters for BaseSopPanelComponent in /Users/brife/svn/lms/sop/branches/current/ng2/src/app/components/base-sop-panel/base-sop-panel.component.ts: ([object Object], ?).
[ERROR] ERROR in ./src/main.ts
[ERROR] Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/brife/svn/lms/sop/branches/current/ng2/src'
[ERROR] resolve './$$_gendir/app/app.module.ngfactory' in '/Users/brife/svn/lms/sop/branches/current/ng2/src'
[ERROR]   using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src)
[ERROR]     Field 'browser' doesn't contain a valid alias configuration
[ERROR]   after using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src)
[ERROR]     using description file: /Users/brife/svn/lms/sop/branches/current/ng2/package.json (relative path: ./src/$$_gendir/app/app.module.ngfactory)
[ERROR]       no extension
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory doesn't exist
[ERROR]       .ts
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.ts doesn't exist
[ERROR]       .js
[ERROR]         Field 'browser' doesn't contain a valid alias configuration
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.js doesn't exist
[ERROR]       as directory
[ERROR]         /Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory doesn't exist
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.ts]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory.js]
[ERROR] [/Users/brife/svn/lms/sop/branches/current/ng2/src/$$_gendir/app/app.module.ngfactory]
[ERROR]  @ ./src/main.ts 3:0-74
[ERROR]  @ multi ./src/main.ts

我不知道如何从这里开始。提前感谢您的帮助。

已解决。组件基类被错误地注释为@component。没有与组件关联的UI,在确定@Components可以扩展非组件之后,我删除了允许--prod构建成功完成的注释

它应该从哪里获得名称?您需要注入令牌或工厂提供者。阅读DI文档。在模块的声明中是否有BaseSopPanelComponent?BaseSopPanelComponent是一个基类,在实例化子类时注入参数。Angular应该不需要注入参数,或者我原来不需要,但是当添加到模块列表时,Angular抱怨构造函数参数注入。