Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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.

I use a Mac with latest iOS and this is the output from 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
like image 748
Nikola Schou Avatar asked Feb 02 '17 22:02

Nikola Schou


1 Answers

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. This should solve your issue.

https://github.com/ternjs/acorn/issues/502

or just run

npm i [email protected] from the project directory (thanks @nodarii)

like image 58
Pierre Drescher Avatar answered Oct 21 '22 04:10

Pierre Drescher