5

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

1
  • Have you ever solved this issue? Commented Nov 22, 2018 at 17:50

2 Answers 2

3

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.
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.