skip to Main Content

I’m sorry for my bad english.
my fault is that when I want to seo the joints in the module.browser class bootstrap does not appear

app.browser.module.ts;

import { AppComponent } from './app.component';
import { AppModule } from './app.module';
import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';

    @NgModule({

        bootstrap: [
            AppComponent
        ],

        imports:[

            BrowserModule.withServerTransition({appId: 'app-root'}),


            AppModule,

        ]
    })
    export class AppBrowserModule {}

my bad eror

D:çalışmalarcodemyWebSite>ng add @ng-toolkit/universal
Installing packages for tooling via npm.
INFO: Project property is set to 'myWebSite'.
ERROR: Bootstrap not found in ./src/.././src/app/app.browser.module.ts.
ERROR: If you think that this error shouldn't occur, please fill up bug report here: https://github.com/maciejtreder/ng-toolkit/issues/new
INFO: stacktrace has been sent to tracking system.
Nothing to be done.

help me please

2

Answers


  1. You should check where you included Bootstrap.

    ERROR: Bootstrap not found in ./src/.././src/app/app.browser.module.ts.

    This error points that, it can not find the right path.

    Login or Signup to reply.
  2. After running once ng add @ng-toolkit/universal we got our initial files generated and retrieved this error.

    For me this solution worked:

    1. Delete app.browser.module.ts
    2. In main.ts you need to insert AppModule (instead of AppBrowserModule) in the .bootstrapModule() function.

    Now your main.ts looks like this:

    import { AppBrowserModule } from '.././src/app/app.browser.module';
    import { enableProdMode } from '@angular/core';
    import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
    
    import { AppModule } from './app/app.module';
    import { environment } from './environments/environment';
    
    
    if (environment.production) {
      enableProdMode();
    }
    
    document.addEventListener('DOMContentLoaded', () => {
                        platformBrowserDynamic()
                          .bootstrapModule(AppModule)
                          .catch(err => console.log(err));
                      });
    
    1. Add bootstrap: [AppComponent] to your app.module.ts @NgModule configuration
    2. Run ng add @ng-toolkit/universal
    3. This will run through successfully but ng-toolkit will leave an invalid line in app.module.ts .withServerTransition({appId:''}), which you can simply delete. Afterwards you can run ng run build:prod and deploy.
    4. If this retrieved an error check if bootstrap: [AppComponent] exists in your app.module.ts and run ng run build:prod again.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search