Skip to content
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

first-app-lesson-00 does not install #55964

Open
medikoo opened this issue May 21, 2024 · 4 comments
Open

first-app-lesson-00 does not install #55964

medikoo opened this issue May 21, 2024 · 4 comments
Labels
area: docs Related to the documentation P2 The issue is important to a large percentage of users, with a workaround
Milestone

Comments

@medikoo
Copy link

medikoo commented May 21, 2024

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

I'm working on fresh system, with Node.js v20.13.1 just installed.

After downloading and running npm install in context of first-app-lesson-00 I get following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: angular.io-example@0.0.0
npm ERR! Found: typescript@4.9.5
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"~4.9.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=5.2 <5.4" from @angular/compiler-cli@17.2.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"17.2.4" from the root project
npm ERR!   peer @angular/compiler-cli@"^17.0.0" from @angular-devkit/build-angular@17.2.3
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"17.2.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

It appears there's some inconsistency in dependencies definition.

It looks very similar to #53283, but it's about different lesson and error reports different dependency

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.2.3
Node: 20.13.1
Package Manager: npm 10.5.2
OS: darwin arm64

Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Anything else?

No response

@AdamModzelewski91
Copy link

Try to use npm ci than npm install.

@medikoo
Copy link
Author

medikoo commented May 22, 2024

Try to use npm ci than npm install.

It doesn't make any difference, as it's very same install method (npm ci just installs everything from scratch and doesn't attempt to complete existing state).

The only way to install it via npm install --force but it's more of a hack not a solution

@pkozlowski-opensource pkozlowski-opensource added the area: adev Angular.dev documentation label May 22, 2024
@ngbot ngbot bot added this to the needsTriage milestone May 22, 2024
@pkozlowski-opensource pkozlowski-opensource added area: docs Related to the documentation and removed area: adev Angular.dev documentation labels May 22, 2024
@PythooonUser
Copy link

Hey,

I didn't check out the code, but from the error message we can conclude some things:

npm ERR! While resolving: angular.io-example@0.0.0
npm ERR! Found: typescript@4.9.5
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"~4.9.3" from the root project

This means that in package.json we have the following entry:

{
  "devDependencies": {
    "typescript": "~4.9.3"
  }
}

As we are allowing patch versions of typescript to be installed, we end up with version typescript@4.9.5.

The error now comes from a dependency that is pulled in, which requires a different typescript version than is installed:

npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=5.2 <5.4" from @angular/compiler-cli@17.2.4

@angular/compiler-cli@17.2.4 needs a peer dependency (so you have to install that yourself via package.json) of typescript between version 5.2.x and 5.3.x.

Looking at the version compatibility chart at https://angular.dev/reference/versions we see that indeed for your Angular version of 17.2 we have to install Typescript 5.2 or 5.3.

grafik

That means it's safe to adjust your typescript version in package.json to - say - ^5.3.

Why?

The chart mentions version 4.9.3 for Angular 16 projects. So probably the tutorial was recently upgraded to Angular 17 and someone forgot to update typescript.

How to fix?

We should update the tutorial project with the correct Typescript version range.

@PythooonUser
Copy link

Mmh, looking at

it seems your version of the tutorial code is out-dated.

@bencodezen bencodezen added the P2 The issue is important to a large percentage of users, with a workaround label Jun 24, 2024
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to the documentation P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

No branches or pull requests

5 participants