简体   繁体   中英

why it is showing error 'ERROR in Tried to find bootstrap code in angular6?

When i need to open my angular project by using the command ng serve --open in cli. it is showing error 'ERROR in Tried to find bootstrap code,but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options. '

Make sure your main.ts have the exact following code:

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();
}

platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => console.log(err));

Please check if you have included the required bootstrap modules in the EntryModule configuration of your application root module. Also, remember to include the style and js related files in your angular.json or .angular-cli.json depending on the version of angular you are using. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM