Przemyslaw Brambor
Przemyslaw Brambor

Reputation: 1

Cannot add SSR to already existing Spartacus project

I just tried to add SSR mode to my already existing Spartacus project by this command:

ng g @spartacus/schematics:add-ssr

and I'm getting this error:

    ✅️ Added 'ts-loader' into devDependencies
Cannot read property 'kind' of undefined

any idea how I can resolve this problem? What is more after trying to add everything manually and after running express server frontend cannot load properly (I follow this documentation).

Upvotes: 0

Views: 388

Answers (2)

Przemyslaw Brambor
Przemyslaw Brambor

Reputation: 1

Logs from ng add @spartacus/schematics --ssr command:

ng add @spartacus/schematics --ssr Skipping installation: Package already installed ✅️ Added '@spartacus/core' into dependencies ✅️ Added '@spartacus/storefront' into dependencies ✅️ Added '@spartacus/assets' into dependencies ✅️ Added '@spartacus/styles' into dependencies ✅️ Added '@ng-bootstrap/ng-bootstrap' into dependencies ✅️ Added '@ng-select/ng-select' into dependencies ✅️ Added '@ngrx/store' into dependencies ✅️ Added '@ngrx/effects' into dependencies ✅️ Added '@ngrx/router-store' into dependencies ✅️ Added 'bootstrap' into dependencies ✅️ Added 'i18next' into dependencies ✅️ Added 'i18next-xhr-backend' into dependencies ✅️ Added '@angular/service-worker' into dependencies ✅️ Added '@angular/localize' into dependencies ✅️ Added 'ngx-infinite-scroll' into dependencies ✅️ Added 'angular-oauth2-oidc' into dependencies Cannot read property 'kind' of undefined

Not sure if it's need but also I tried to run yarn build:core:lib command:

yarn build:core:lib yarn run v1.22.5 error Command "build:core:lib" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Upvotes: 0

Matejk00
Matejk00

Reputation: 144

The recommended way to add SSR support to Spartacus is to use schematics. Please try it with following command: ng add @spartacus/schematics --ssr

Ensure that your project meets all of the necessary prerequisites: https://sap.github.io/spartacus-docs/schematics/#prerequisites

You can also try to remove node_modules folder and install all dependencies once again.

Upvotes: 3

Related Questions