Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 Bootstrap not found in ./src/.././src/app/app.browser.module.ts

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ışmalar\code\myWebSite>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

like image 627
Veysel Sebu Avatar asked Oct 16 '22 13:10

Veysel Sebu


1 Answers

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.
like image 144
DerKarim Avatar answered Oct 20 '22 15:10

DerKarim