Angular --prod构建失败

时间:2017-09-21 19:34:49

标签: 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/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

我不确定如何从这里开始。在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

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