angular-cli: Angular-CLI 1.5.0.rc3 + Angular 5.0.0-rc.5: Module build failed: Error: TypeScript compilation failed.

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Node: 8.7.0
OS: linux x64
Angular: 5.0.0-rc.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0-rc.3
@angular-devkit/build-optimizer: 0.0.30
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.34
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.0.48
typescript: 2.3.4
webpack: 3.8.1

Repro steps.

ng new mytest
open package.json and replace all `^4.2.4` with `5.0.0-rc.5`
open package.json and set typescript version to 2.4.2
yarn install
ng build --prod

The log given by the failure.

ERROR in ./src/main.ts
Module build failed: Error: TypeScript compilation failed.
    at plugin.done.then (/var/jenkins_home/tmp/mytest2/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/loader.js:479:27)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ multi ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: Error: TypeScript compilation failed.
    at plugin.done.then (/var/jenkins_home/tmp/mytest2/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/loader.js:479:27)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ multi ./src/polyfills.ts
ERROR in Error: TypeError: Cannot read property 'length' of undefined
    at Object.unescapeIdentifier (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:10550:27)
    at getTextOfNode (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:68575:27)
    at emitIdentifier (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66931:19)
    at pipelineEmitUnspecified (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66594:28)
    at pipelineEmitWithHint (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66566:50)
    at pipelineEmitWithSourceMap (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66558:17)
    at emitNodeWithComments (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:64200:17)
    at pipelineEmitWithComments (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66547:17)
    at pipelineEmitWithNotification (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66541:17)
    at emit (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66528:13)
    at emitParameter (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66967:13)
    at pipelineEmitUnspecified (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66605:28)
    at pipelineEmitWithHint (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66566:50)
    at pipelineEmitWithSourceMap (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66558:17)
    at emitNodeWithComments (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:64200:17)
    at pipelineEmitWithComments (/var/jenkins_home/tmp/mytest2/node_modules/typescript/lib/typescript.js:66547:17)

Desired functionality.

Successful build.

Mention any other details that might be useful.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (13 by maintainers)

Most upvoted comments

I’m going to keep this alive because of the discussion, but this is a duplicate of https://github.com/angular/angular-cli/issues/8107 and will be closed as such when we find a solution.

Seems to be another duplicate of the issue with multiple TypeScript versions in the project. See https://github.com/angular/angular-cli/issues/5053, https://github.com/angular/angular-cli/issues/8107, https://github.com/angular/angular-cli/issues/8174.

You goal should be to ensure that your project has single instance of TypeScript package. Linked issues describe some workarounds how to achieve it.