-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
angular-cli compiles project using TypeScript 2.5.x, irrespective of TS version in package.json #8174
Comments
That workaround is giving me errors:
|
This is probably a duplicate of #8107. Or the root cause is the same at least. IMO The proper workaround is to edit Should be something like this, note 3 versions in the same resolution record. And there should be no other resolution records for
Then I would also recommend to not use global |
@Splaktar After updating your |
@devoto13 Thanks for your response! I did search for existing issues but I guess I wasn't using the right keywords… Regarding the question of a "proper" work-around: I don't like adding addditional dependencies, either, but editing |
Alternatively, you can use npm which doesn’t exhibit the problem. |
@codethief Maybe, but it fixes exactly the root cause of the problem. And this change is not something inherently incorrect. Yarn just can't de-duplicate some version specifications. So you sort of helping it to do this de-duplication :) @clydin Heh, NPM brings so many problems instead... But it's definitely an option. |
@codethief I tried your workaround, including removing yarn.lock and node_modules before doing a fresh install with yarn install. I got the same error that @Splaktar reported. |
@codethief I'm seeing this on npm @clydin which version of NPM works for you? |
@karptonite @Splaktar I'm only guessing here but I suppose this is another de-duplicating issue, in this case because yarn (or npm) still downloads a separate copy of |
This does sound an awful lot like #8107, but the mention of @codethief what version of |
I don't see
Are you using a linked Angular CLI maybe? |
@filipesilva I'm sorry, you are right of course. The copy of chalk I have in So TypeScript 2.5.3 indeed seems to be pulled due to angular-cli depending on |
@Splaktar I use both 3.10.10 and 5.4.2 regularly without issue. I just did a test with clean installs of node v6.11.5 (npm v3.10.10) and node v8.8.0 (npm v5.4.2). With both, a new CLI (v1.4.9) project has only TS 2.3.4. Also tested various yarn versions. Versions beyond 0.26.1 appear to produce the issue. |
Fixed by #8185 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
$ ng new my-project
.src/app/app.component.ts
(see What's new in TypeScript for inspiration), e.g.:$ ng serve
or$ ng build --aot
The log given by the failure.
In the above setup, running
$ ng serve
or$ ng build --aot
fails with the following error message:This means that the code is getting compiled with at least TypeScript >2.4, instead of the expected version 2.3.4 (as per my project's
package.json
– which angular-cli generated).Desired functionality.
The code should compile (JIT and AOT) as my project's package.json lists
"typescript": "~2.3.3"
as a dependency.Mention any other details that might be useful.
yarn link
lists the following dependencies forangular-cli
:and, indeed:
confirming that TypeScript 2.5.3 was installed (which is probably because of angular-cli's
chalk
dependency which depends precisely on TypeScript 2.5.3 or higher). Now, I suspect that@ngtools/webpack
– which angular-cli uses for compiling – will simply take its sibling TypeScript node module for compilation. So since it's also being installed tonode_modules/@angular/cli/node_modules/
, it will use the TypeScript version innode_modules/@angular/cli/node_modules/typescript
(i.e. 2.5.3), notnode_modules/typescript
(which is v2.3.4).Temporary workaround.
Add
@ngtools/webpack
as a dev dependency to your Angular project'spackage.json
. Afterwards remove thenode_modules
folder and theyarn.lock
file and resolve all dependencies from scratch using$ yarn install
.@ngtools/webpack
will then be installed tonode_modules/@ngtools/webpack
and should thus find the TypeScript version innode_modules/typescript
.The text was updated successfully, but these errors were encountered: