Repository navigation
Closed
Description
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.
Reacted by Mark Goho and Michael Prentice
Metadata
Metadata
Assignees
Labels
No labels
Activity
Stradivario commentedon Oct 24, 2017
When you try to save something inside application webpack rebuilds the application and it passes, so it is working but after a little interaction :D.
I have similar problem with 1.5.0-beta.3 and angular 5.0.0-rc.3
Splaktar commentedon Oct 24, 2017
@Stradivario interesting hack, but that doesn't work for me.
I'm seeing this on:
devoto13 commentedon Oct 24, 2017
Seems to be another duplicate of the issue with multiple TypeScript versions in the project. See #5053, #8107, #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.
hansl commentedon Oct 24, 2017
I'm looking at this right now. Not a duplicate.
devoto13 commentedon Oct 24, 2017
@hansl after following instructions I get two instances of
typescriptpackage. Excerpt fromyarn.lock:After de-duplicating it using approach I described in #8174 (comment), the error is gone. It is definitely a duplicate. There is a detailed description of what is going wrong in #8107 (comment).
These are two instances:
hansl commentedon Oct 24, 2017
Okay. Even when I have 2 versions of typescript I cannot reproduce it here.
hansl commentedon Oct 24, 2017
devoto13 commentedon Oct 24, 2017
There were fixes related to
peerDependenciesresolution in 1.1.0 and 1.2.1. Can you try with Yarn 1.2.1? This is the version I use.hansl commentedon Oct 24, 2017
I'm going to keep this alive because of the discussion, but this is a duplicate of #8107 and will be closed as such when we find a solution.
hansl commentedon Oct 24, 2017
I've been able to reproduce with Yarn 1.2.1. Here's what I get now:
hansl commentedon Oct 24, 2017
Interestingly, the node_modules structure is different...
hansl commentedon Oct 24, 2017
It looks like under yarn 1.2 there's no typescript package under
node_modules/@angular/cli/node_modules/@ngtools/webpack/node_modules, which is probably why it works when that's there.devoto13 commentedon Oct 25, 2017
I did some further investigation. And you're right, it was working in 1.0.2 exactly because Yarn was (incorrectly) putting extra
typescriptinstance of version 2.4.2 under@ngtools/webpack. Thereforeimport 'typescript'was resolving to 2.4.2 in both@ngtools/webpackand@angular/compiler-clipackages.With 1.2.1 the incorrect extra instance is gone and therefore
import 'typescript'resolves to 2.5.3 in@ngtools/webpackand to 2.4.2 in@angular/compiler-cli. Since data structures are different between versions attempt to use objects created by one version inside another one leads to the exception.So the desired fix should be to remove dependency on
typescriptfrom@angular/clipackage as suggested in #8107 (comment). This ensures that there is only one instance oftypescriptpackage in the project.filipesilva commentedon Oct 25, 2017
Fixed by #8185
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.