1

I followed official documentation and link here but none of it helped me to get going. I keep getting the below error -

C:\Tools\workspace\app-name>npm run ng add @spartacus/schematics@4

> app-name@0.0.0 ng C:\Tools\workspace\app-name
> ng "add" "@spartacus/schematics@4"

i Using package manager: npm
‼ Package has unmet peer dependencies. Adding the package may not succeed.

The package @spartacus/schematics@4 will be installed and executed.
Would you like to proceed? Yes
√ Packages successfully installed.
? Which Spartacus features would you like to set up?
Please note that for most Spartacus features to be properly configured, the Account feature is required. Assisted Services Module, Import/Export, Saved Cart, Quick Order, Checkout, Order, Product -
Variants, Product - Image Zoom, SmartEdit, Store Finder, Tracking - Personalization, User - Account, User - Profile
Must use import to load ES Module: C:\Tools\workspace\app-name\node_modules\@angular\compiler\fesm2015\compiler.mjs
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-name@0.0.0 ng: `ng "add" "@spartacus/schematics@4"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-name@0.0.0 ng script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\M1088751\AppData\Roaming\npm-cache\_logs\2023-03-01T08_35_23_119Z-debug.log
a p
  • 1,121
  • 6
  • 26
  • 51
  • It's just a shot in the dark, but I followed the "Must use import to load ES Module" error and I got this: https://stackoverflow.com/questions/69081410/error-err-require-esm-require-of-es-module-not-supported/69491823#69491823 – Mihai Mar 01 '23 at 10:17
  • @Mihai thanks but it didn't help – a p Mar 01 '23 at 12:33

2 Answers2

0

Please make sure to use Angular 12 with Spartacus v4. See https://sap.github.io/spartacus-docs/building-the-spartacus-storefront-from-libraries-4-x/

Krzysztof Platis
  • 1,183
  • 5
  • 14
0

Check your angular version by running the below command in your command prompt

ng version

As per Spartacus documentation https://github.com/SAP/spartacus#requirements

Install Angular 12 version by running

  1. npm uninstall -g @angular/cli
  2. npm i @angular/cli@12.2.18

Install Node 14. version** If you may find how to use nodejs specific version in local folder

This will resolve your issue

Santosh Kori
  • 461
  • 4
  • 12