Angular AOT error while compiling (something with angular / compiler-cli)

After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and get the following error

"node_modules/.bin/ngc" -p tsconfig-aot.json

TypeError: compiler.AnimationParser is not a constructor
at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400)
at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36)
at Object.main (C:\Projects\NeilKellyClient4\node_modules\@angular\tsc-wrapped\src\main.js:37:16)
at Object.<anonymous> (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:16:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
Compilation failed

I am stuck at this point. Any reason angular / compiler-cli throws this error?

+2
source share
2 answers

As you say, this is a version conflict. I had the same problem and I had to reinstall the package in order for it to work with the specified version. I would suggest installing release versions and re-launching until you get what you want. For what it's worth, I had the same error, and 2.1.2 worked for me.

npm install @angular/compiler-cli@2.1.2 --save-dev

, , , . npm list --depth=0 , -. , - .

+1

, 2.2.0 angular, compiler-cli. npm install, 2.2.0, . package.json:

"dependencies": {
    "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/compiler-cli": "^2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/platform-server": "^2.2.0",
    "@angular/router": "~3.2.0",
    "@angular/upgrade": "~2.2.0",
+1

Source: https://habr.com/ru/post/1679378/


All Articles