node.js - webpack 编译出错

标签 node.js angular npm npm-install

我在尝试运行 angular2 项目时遇到错误。它发生在从带有 ubuntu 的 PC 切换到 MacOS X 之后。 Node 版本: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.

最佳答案

刚刚将我的宠物项目更新为@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/

关于node.js - webpack 编译出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43076615/

相关文章:

node.js - 如何在 NodeJS/Express 中的页面刷新之间保留 node-dbox token

html - int中每个数字的Angular4 : How do I *ngFor,?

返回 promise 时,Angular APP_INITIALIZER 不会延迟应用程序初始化

javascript - 如何解决 npm 对等依赖问题?

npm - "yarn add global "可以更新npm安装的包吗?

typescript - 如何使用通用实用程序构建 NPM 包

node.js - socket.io 轮询问题,持续连接/断开连接

security - 如何防止 Node.js/Express 提供我的应用程序的源代码?

node.js - 如何使用 Passport/Facebook 策略/验证 Supertest 请求?

javascript - 将 2 个 json 文件映射到一个 json