angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
96.13k stars 25.44k forks source link

build: `angular-in-memory-web-api` is not compatible with prerelease versions of Angular #46715

Closed gkalpak closed 7 months ago

gkalpak commented 2 years ago

Description

angular-in-memory-web-api has a peer-dependency on @angular/{common,core}. In v0.14.x of angular-in-memory-api the peer-deps version for @angular/* packages is set to ^14.0.0. This includes all stable versions of v14, but excludes prerelease versions.

For example, our docs examples currently use Angular v14.1.0-next.3, which means that if someone downloads an example and tries to npm install they will get an error. (This is not an issue with older versions of npm or yarn, since those do not try to enforce peer dependencies by default.)

Related issue: #46609 Internal discussion: here

BTW, if we want angular-in-memory-api to be compatible with v14.x prereleases, then we need to explicitly list each minor version (this is how prerelease version range matching works for npm/yarn - see for example yarn docs).

So, for v14.x, it should be something like: ^14.0.0-0 || ^14.1.0-0 || ^14.2.0-0 || ^14.3.0-0 || ...

Since we typically expect to release 3 or 4 minor versions per major, we could preemptively specify 4 or 5 prerelease versions (even if some of them will never end up been released).

What is the affected URL?

Any guide with a downloadable example (for example, https://angular.io/tutorial/toh-pt6).

Please provide the steps to reproduce the issue

Download and extract an example and run npm install.

Please provide the expected behavior vs the actual behavior you encountered

Expected: No installation error. Actual: Installation error due to unmet peer dependency for angular-in-memory-web-api.

Please provide a screenshot if possible

No response

Please provide the exception or error you saw

No response

Is this a browser-specific issue? If so, please specify the device, browser, and version.

No response

alan-agius4 commented 2 years ago

For example, our docs examples currently use Angular v14.1.0-next.3

I don’t think for examples/tutorials we should use pre-releases.

devversion commented 2 years ago

FWIW: Even with us not updating examples to pre-releases automatically, I think in the past we always updated examples before a major to test/prepare for the stable release (only main though)

I guess the better question would be: Should next.angular.io use the latest pre-releases to reflect what it documents, and should the latest site just use the corresponding stable releases

devversion commented 2 years ago

It's easy to disable the next tag updates for examples though. The main intent of the Renovate config change was to update AIO itself, but locking to stable for the examples seems acceptable

alan-agius4 commented 2 years ago

For the examples I think we should always use the stable version when not it’s not being accessed for next.angular.io

lgimberis commented 1 year ago

Hi, I think this is the same problem I just ran into while following the "first steps" guide here exactly: https://angular.io/tutorial/first-app/first-app-lesson-01#step-1---test-the-default-app

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: @angular/common@16.0.0
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^16.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^15.0.0" from angular-in-memory-web-api@0.15.0
npm ERR! node_modules/angular-in-memory-web-api
npm ERR!   angular-in-memory-web-api@"~0.15.0" from the root project

Managed to get around it with via --legacy-peer-deps, so maybe that page could mention this as part of troubleshooting, regardless of whether this *web-api package is updated to allow using future versions of angular?

Tyler-V commented 1 year ago

Angular in-memory-web-api@0.15.0 is not compatible with angular v16

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: angular-in-memory-web-api@0.15.0
npm ERR! Found: @angular/common@16.0.0
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^16.0.0" from the root project
npm ERR!   peer @angular/common@"^16.0.0 || ^17.0.0" from @angular/cdk@16.0.0
npm ERR!   node_modules/@angular/cdk
npm ERR!     @angular/cdk@"^16.0.0" from the root project
npm ERR!     peer @angular/cdk@"16.0.0" from @angular/material@16.0.0
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"^16.0.0" from the root project
npm ERR!   26 more (@angular/forms, @angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^15.0.0" from angular-in-memory-web-api@0.15.0
npm ERR! node_modules/angular-in-memory-web-api
npm ERR!   angular-in-memory-web-api@"^0.15.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/common@15.2.9
npm ERR! node_modules/@angular/common
npm ERR!   peer @angular/common@"^15.0.0" from angular-in-memory-web-api@0.15.0
npm ERR!   node_modules/angular-in-memory-web-api
npm ERR!     angular-in-memory-web-api@"^0.15.0" 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.
npm ERR!
alxhub commented 7 months ago

Closing as obsolete.

angular-automatic-lock-bot[bot] commented 6 months ago

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.