webpack编译中的错误

时间:2017-03-28 17:54:08

标签: node.js angular npm npm-install

我在尝试运行angular2项目时遇到错误。从使用ubuntu的PC切换到MacOS X后发生。节点版本:7.7.4,npm版本:4.1.2。我正在运行npm webpack-dev-server --inline --progress --watch --port 8180,然后我收到了这些信息:

WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
69:15-36 Critical dependency: the request of a dependency is an expression

WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
85:15-102 Critical dependency: the request of a dependency is an expression

WARNING in ./~/angular2-focus/~/@angular/core/@angular/core.es5.js
5889:15-36 Critical dependency: the request of a dependency is an expression

WARNING in ./~/angular2-focus/~/@angular/core/@angular/core.es5.js
5905:15-102 Critical dependency: the request of a dependency is an expression

ERROR in [default] /Users/user/Documents/Java/WORK/mediahelper/media-helper/src/main/web/node_modules/angular2-focus/node_modules/@angular/core/src/animation/animation_metadata_wrapped.d.ts:12:32 
Initializers are not allowed in ambient contexts.

[...]

ERROR in [default] /Users/user/node_modules/@types/core-js/index.d.ts:651:4 
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/user/node_modules/@types/core-js/index.d.ts:666:4 
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/user/node_modules/@types/core-js/index.d.ts:680:4 
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] /Users/user/node_modules/@types/core-js/index.d.ts:692:4 
All declarations of 'value' must have identical modifiers.

ERROR in [default] /Users/user/node_modules/@types/core-js/index.d.ts:804:4 
All declarations of 'prototype' must have identical modifiers.

1 个答案:

答案 0 :(得分:1)

刚刚将我的宠物项目更新为@ angular4并获得了类似的警告

angular/core.es5.js 5889:15-36 Critical dependency: 
the request of a dependency is an expression

更改您的webpack.conf.js

from: /angular(\|/)core(\|/)(esm(\|/)src|src)(\|/)linker/
to:   /angular(\|/)core(\|/)@angular/

链接到reddit主题:https://www.reddit.com/r/Angular2/comments/6160c2/angular_400_now_available/dfci3gm/