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

[Bug]: npm dependencies update in an o3r generated project are not handled correctly #2681

Open
malek-benazzouz opened this issue Jan 9, 2025 · 2 comments
Labels
bug Something isn't working priority:medium

Comments

@malek-benazzouz
Copy link

Package name

core

Package version

11.5.6

Reproduction steps

Generate a project with an app:

npm create @o3r project # Uses o3r deps v 11.5.6
cd project
ng g application app

Then, update all the @o3r/x dependencies in both the root package.json and the app package.json files, to a newer version, for example version 11.6.0-rc.2.

Then run npm install to install all these new versions.

Current result

The npm install command fails:

$ npm i
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: @ama-sdk/[email protected]
npm error node_modules/@ama-sdk/core
npm error   @ama-sdk/core@"~11.6.0-rc.2" from the root project
npm error   peerOptional @ama-sdk/core@"^11.5.6" from @ama-sdk/[email protected]
npm error   node_modules/@ama-sdk/schematics
npm error     @ama-sdk/schematics@"~11.6.0-rc.2" from the root project
npm error   1 more (@o3r/store-sync)
npm error
npm error Could not resolve dependency:
npm error @ama-sdk/core@"~11.6.0-rc.2" from the root project
npm error
npm error Conflicting peer dependency: @o3r/[email protected]
npm error node_modules/@o3r/schematics
npm error   peerOptional @o3r/schematics@"^11.6.0-rc.5" from @ama-sdk/[email protected]
npm error   node_modules/@ama-sdk/core
npm error     @ama-sdk/core@"~11.6.0-rc.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\mbenazzouz\AppData\Local\npm-cache\_logs\2025-01-09T12_51_00_904Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\mbenazzouz\AppData\Local\npm-cache\_logs\2025-01-09T12_51_00_904Z-debug-0.log

Note: if I retry using --force option, it manages to install all the deps correctly.

Expected result

I would expect my npm install to correctly install the new versions, without having to pass --force option.

Additional comments

No response

@malek-benazzouz malek-benazzouz added bug Something isn't working triage labels Jan 9, 2025
@kpanot
Copy link
Contributor

kpanot commented Jan 17, 2025

Hi,

It seems that your issue is because you upgrade has been done manually and some packages (including the @ama-sdk/*) are missing.

The recommended processes to upgrade are the following:

  • ng upgrade @o3r/core via the Angular Upgrade process
  • yarn up '@o3r/*' '@ama-sdk/*' (or npm up '@o3r/*' '@ama-sdk/*') to update without Angular update

@malek-benazzouz
Copy link
Author

malek-benazzouz commented Jan 17, 2025

Hi Kilian, thanks for the answer!

I actually used the ng update @o3r/[email protected] command to handle the upgrade, and it did install the @ama-sdk/* deps.

But the issue is that in a monorepo, the ng update only handles the root package.json file.
There is no harmonization with the app package.json file, so there is no choice but to manually update the app deps.
When updating the app deps, I actually did update the @ama-sdk/* deps, but somehow, because the old versions are still in package-lock.json file at the time I run my npm install, it fails. It seems like it does not handle multiple workspaces properly.

Running an npm install --force fixes the issue in this case, and after that all the deps are correct in both the root and the app (including the @ama-sdk/* ones).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:medium
Projects
None yet
Development

No branches or pull requests

3 participants