I just created a brand new project using the newest angular CLI 13.3.6 (node 16.15.0, yarn 1.22.15). I'm trying to add spartacus as described here: https://sap.github.io/spartacus-docs/building-the-spartacus-storefront-from-libraries-4-x/ but when I run
ng add @spartacus/schematics@latest
I get the following error:
‼ Package has unmet peer dependencies. Adding the package may not succeed. No terminal detected. '--skip-confirmation' can be used to bypass installation confirmation. Ensure package name is correct prior to '--skip-confirmation' option usage. Command aborted.
I also tried --force as suggested by @AhmedSHA256 - no use. That's what I get:
ng add @spartacus/schematics@latest --skip-confirmation --force
- Determining package manager... i Using package manager: npm
- Loading package information from registry... ‼ Package has unmet peer dependencies. Adding the package may not succeed.
- Installing package...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: spartacus@0.0.0
npm ERR! Found: @angular/compiler@13.3.9
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"~13.3.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"^12.0.5" from @spartacus/schematics@4.3.3
npm ERR! node_modules/@spartacus/schematics
npm ERR! dev @spartacus/schematics@"4.3.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.
npm ERR!
npm ERR! See C:\Users\kpw\AppData\Local\npm-cache\eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\kpw\AppData\Local\npm-cache_logs\2022-05-20T09_54_05_770Z-debug-0.log × Package install failed, see above.
What can I do to add spartacus?
At the time of writing, the latest version of Spartacus (v4) supports only Angular 12. You have installed Angular 13 and that's probably why you're getting warnings about incompatible peer dependencies. For more, see the requirements docs of Spartacus v4.
Please create a fresh Angular 12 application, and then install Spartacus v4.
Note: The future major release of Spartacus (v5) plans to support a new major version of Angular.