Angular2 CLI Build Prod错误:调用函数’NoOpAnimationDriver’,不支持函数调用

当我切换到使用@angular 2.4.4时,我开始收到以下错误.当我恢复到@angular 2.2.1时.我可以毫无问题地建造.

当使用角度2.4.4时,我仍然可以使用“npm start”在本地运行我的程序.

只有当我尝试使用“ng build –prod –aot”运行构建时才会出现错误.

据我所知,我没有使用错误中引用的“NoOpAnimationDriver”或“BrowserTestingModule”.

我希望有人之前看到过这个错误,并且可以告诉我以下任何一个错误:
1.错误真的在说什么.
2.为什么我在我没有使用的功能中出现错误.
3.我如何能够修复错误.
4.我可以在哪里查找有关如何理解这些错误的更多信息.

ERROR in Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/testing/browser.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'c:\Development\SentriKeyApp\src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve 'c:\Development\SentriKeyApp\src\$$_gendir' in 'c:\Development\SentriKeyApp\node_modules\@angular\core\src\linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 71:15-36 87:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

最佳答案 ng build –prod调用 – 也看起来问题与它有关.

尝试运行ng build –prod –aot false以避免Ahead-of-Time Compilation

点赞