1

I have followed below steps to create Spartacus storefront,

  1. ng new spartacus3
  2. cd spartacus3
  3. ng add @spartacus/schematics --baseUrl https://spartacus-demo.eastus.cloudapp.azure.com:8443/ --baseSite=electronics-spa --ssr
  4. yarn install
  5. yarn start

It installs Angular 10.2.4 and Spartacus 3.1.

It compiles without error.

But am getting blank screen when I'm opening same in browser using URL http://localhost:4200/ I verified network tab in browser it have valid response. Here is network tab screenshot - screenshot - 1, screenshot 2

But no one elements are getting added in DOM. Here is elements tab screenshot - elements tab screenshot

But in console I have below info,

spartacus-storefront.js:17341 No component implementation found for the CMS component type 'ProfileTagScriptComponent'.Make sure you implement a component and register it in the mapper .

Console tab screenshot

I followed below link, https://sap.github.io/spartacus-docs/schematics/#adding-spartacus-core-libraries-and-features-to-your-angular-project

Please help me to get working Spartacus app in my local.

Below is my app.module.ts code,

    import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { translations, translationChunksConfig } from '@spartacus/assets';
import { B2cStorefrontModule } from '@spartacus/storefront';
import { StoreFinderRootModule } from '@spartacus/storefinder/root';
import { provideConfig } from '@spartacus/core';
import { storeFinderTranslations } from '@spartacus/storefinder/assets';
import { storeFinderTranslationChunksConfig } from '@spartacus/storefinder/assets';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    B2cStorefrontModule.withConfig({
      featureModules: {
        storeFinder: {
          module: () => import('@spartacus/storefinder').then(
            (m) => m.StoreFinderModule
          ),
        },
      },
      backend: {
        occ: {
          baseUrl: 'https://spartacus-demo.eastus.cloudapp.azure.com:8443',
          prefix: '/occ/v2/'
        }
      },
      context: {
        currency: ['USD'],
        language: ['en'],
      },
      i18n: {
        resources: translations,
        chunks: translationChunksConfig,
        fallbackLang: 'en'
      },
      features: {
        level: '3.0'
      }
    }),
    StoreFinderRootModule
  ],
  providers: [
    provideConfig({
      i18n: {
        resources: storeFinderTranslations,
        chunks: storeFinderTranslationChunksConfig,
      },
    })],
  bootstrap: [AppComponent]
})
export class AppModule { }
3
  • Did you check console log?
    – mkysoft
    Commented Mar 31, 2021 at 14:01
  • @mkysoft I have no errors in console. But getting below information: spartacus-storefront.js:17341 No component implementation found for the CMS component type 'ProfileTagScriptComponent'. Make sure you implement a component and register it in the mapper. Attached console screenshot as well in the description. Here is link, i.sstatic.net/1GlEP.png Commented Mar 31, 2021 at 14:14
  • Can you add baseSite: [your site uid] inside context to see whether it work or not? Commented Apr 7, 2021 at 15:05

2 Answers 2

2

Once added below config in app.module, then app works fine,

{
  provide: ROUTER_CONFIGURATION,
  useValue: {
    scrollPositionRestoration: 'enabled',
  }
}

This code snip is not required for Spartacus version above/= 3.2 as the app have new structure.

1

In app.module.ts use this baseUrl link baseUrl: 'https://spartacus-training.eastus.cloudapp.azure.com:8443',

1
  • Thanks @Co ti. I added below code in app.module.ts then it started working. { provide: ROUTER_CONFIGURATION, useValue: { scrollPositionRestoration: 'enabled', } } Commented May 14, 2021 at 10:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.