[英]Module parse failed: Parenthesized pattern You may need an appropriate loader to handle this file type
I have created a brand new angular 2 application using these commands: 我使用以下命令创建了一个全新的angular 2应用程序:
ng init
ng server
I get this error output: 我收到此错误输出:
chunk {1} styles.bundle.js, styles.bundle.map (styles) 9.96 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 2.65 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
ERROR in ./~/@angular/core/src/util/decorators.js
Module parse failed: /Users/nikolaschou/Dev/coziv/sandbox01/blockhowapp/temp/node_modules/@angular/core/src/util/decorators.js Parenthesized pattern (156:12)
You may need an appropriate loader to handle this file type.
|if (clsDef.hasOwnProperty('extends')) {
| if (typeof clsDef.extends === 'function') {
Can anyone explain why I might get this error? 任何人都可以解释为什么我会得到这个错误? I see a lot of similar errors reported, but not exactly this variation.
我看到报告了很多类似的错误,但不完全是这种变化。
More details 更多细节
I can say that ng serve works well from another angular-2 application folder on the same machine and I have compared these two folders but don't see any obvious differences that can explain this behavior. 我可以说ng服务在同一台机器上的另一个angular-2应用程序文件夹中运行良好,我比较了这两个文件夹,但没有看到任何可以解释这种行为的明显差异。
I use a Mac with latest iOS and this is the output from ng --version: 我使用带有最新iOS的Mac,这是ng --version的输出:
angular-cli: 1.0.0-beta.26
node: 6.6.0
os: darwin x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5
The dependency that caused this to fail is now updated. 导致此失败的依赖关系现在已更新。 If you uninstall webpack and reinstall webpack it will update acorn to version 4.0.7.
如果卸载webpack并重新安装webpack,它会将acorn更新到4.0.7版。 This should solve your issue.
这应该可以解决您的问题。
https://github.com/ternjs/acorn/issues/502 https://github.com/ternjs/acorn/issues/502
or just run 或者只是跑步
npm i acorn@4.0.8
from the project directory (thanks @nodarii) 来自项目目录的
npm i acorn@4.0.8
(感谢@nodarii)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.