The module ... was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method

See original GitHub issue

getting this error after following the latest Quick Start example from scratch.

according to the FAQ this shouldn’t be needed?

Most application developers won’t need to add components to the entryComponents.

Angular adds certain components to entry components automatically. Components listed in @NgModule.bootstrap are added automatically. Components referenced in router configuration are added automatically. These two mechanisms account for almost all entry components.

not quite sure how to troubleshoot it. The entire error looks like this:

core.umd.js:3468 Error: The module AppModule was bootstrapped, but it does not declare “@NgModule.bootstrap” components nor a “ngDoBootstrap” method. Please define one of these. at PlatformRef_._moduleDoBootstrap (core.umd.js:6966) at eval (core.umd.js:6928)

main.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

app.module.ts

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

@NgModule({
  imports:      [ BrowserModule ]
})
export class AppModule { }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
anilkriscommented, Oct 12, 2016

I think you still need to add in @NgModule, as the FAQ, says the components added in @NgModule will be automatically loaded. So you need to import your new component and add the entries in @NgModule. Some thing like below/ BTW, this is part of quickstart.

import { AppComponent } from ‘./app.component’; @NgModule({ imports: [ BrowserModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] })

4reactions
bofcarbon1commented, Feb 7, 2017

Why exactly do we have to import the same item twice? Some of these are NgModule and some are not. I wonder what the point was.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Upgrading AngularJS to Angular, AppModule was ...
Error: Uncaught (in promise): Error: The module AppModule was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a " ...
Read more >
How to manually bootstrap an Angular application - Medium
The module AppModule was bootstrapped, but it does not declare “@NgModule.bootstrap” components nor a “ngDoBootstrap” method. Please define one of these.
Read more >
angular/angular - Gitter
ERROR Error : The module AppModule was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method in my chrome ...
Read more >
Entry components - Angular
You specify an entry component by bootstrapping it in an NgModule, ... can also be bootstrapped imperatively in the module's ngDoBootstrap() method.
Read more >
Angular Modules - Tutorial - Vskills
Modules can be loaded eagerly when the application starts or lazy loaded asynchronously by the router. NgModule metadata does the following: Declares which ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found