简体   繁体   English

模块分析失败:括号模式您可能需要适当的加载程序来处理此文件类型

[英]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.

相关问题 模块解析失败:您可能需要适当的加载程序来处理此文件类型 - Module parse failed:You may need an appropriate loader to handle this file type Angular 2 - Karma 错误 - 模块解析失败“您可能需要合适的加载程序来处理此文件类型” - Angular 2 - Karma Error - Module Parse Failed 'You may need an appropriate loader to handle this file type' 未捕获的错误:模块解析失败:您可能需要合适的加载程序来处理此文件类型 - Uncaught Error: Module parse failed:You may need an appropriate loader to handle this file type 未捕获(承诺):错误:模块解析失败:意外令牌(91:0)您可能需要适当的加载程序来处理此文件类型 - Uncaught (in promise): Error: Module parse failed: Unexpected token (91:0) You may need an appropriate loader to handle this file type 您可能需要适当的加载器来处理此文件类型-带有React的Angular 4 - You may need an appropriate loader to handle this file type - Angular 4 with React 您可能需要适当的加载程序来处理此文件-.net core和Angular - You may need an appropriate loader to handle this file - .net core & Angular “你可能需要一个适合这种文件类型的加载器”,webpack 无法解析 angular2 文件 - “You may need an appropriate loader for this file type”, webpack can't parse angular2 file index.ngfactory.ts意外的令牌,您可能需要适当的加载程序来处理此文件类型 - index.ngfactory.ts Unexpected token, You may need an appropriate loader to handle this file type 您可能需要适当的加载程序来处理此文件类型。 Angular 5应用程序中的错误 - You may need an appropriate loader to handle this file type. error in Angular 5 app 使用 Angular 和 LitElement 时,您可能需要适当的加载程序来处理此文件类型 - You may need an appropriate loader to handle this file type when using Angular and LitElement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM