Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
OS?
Windows 10
Versions.
Node: v7.2.0 npm 3.10.9 Angular: 2.0.0-beta.8
main.ts `import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {BrowserModule} from '@angular/platform-browser'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import { MdAutocompleteModule, MdButtonModule, MdButtonToggleModule, MdCardModule, MdCheckboxModule, MdChipsModule, MdCoreModule, MdDatepickerModule, MdDialogModule, MdExpansionModule, MdGridListModule, MdIconModule, MdInputModule, MdListModule, MdMenuModule, MdNativeDateModule, MdPaginatorModule, MdProgressBarModule, MdProgressSpinnerModule, MdRadioModule, MdRippleModule, MdSelectModule, MdSidenavModule, MdSliderModule, MdSlideToggleModule, MdSnackBarModule, MdSortModule, MdTableModule, MdTabsModule, MdToolbarModule, MdTooltipModule, } from '@angular/material'; import {InputFormExample} from './input-form-example'; import {HttpModule} from '@angular/http'; import {CdkTableModule} from '@angular/cdk';
@NgModule({ exports: [ CdkTableModule, MdAutocompleteModule, MdButtonModule, MdButtonToggleModule, MdCardModule, MdCheckboxModule, MdChipsModule, MdCoreModule, MdDatepickerModule, MdDialogModule, MdExpansionModule, MdGridListModule, MdIconModule, MdInputModule, MdListModule, MdMenuModule, MdNativeDateModule, MdPaginatorModule, MdProgressBarModule, MdProgressSpinnerModule, MdRadioModule, MdRippleModule, MdSelectModule, MdSidenavModule, MdSliderModule, MdSlideToggleModule, MdSnackBarModule, MdSortModule, MdTableModule, MdTabsModule, MdToolbarModule, MdTooltipModule, ] }) export class PlunkerMaterialModule {}
@NgModule({
imports: [ BrowserModule, BrowserAnimationsModule, FormsModule, HttpModule, PlunkerMaterialModule, MdNativeDateModule, ReactiveFormsModule, ],
declarations: [InputFormExample], bootstrap: [InputFormExample], providers: [] })platformBrowserDynamic().bootstrapModule(AppModule); `
app.module.ts
`import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; import {MdButtonModule, MdCheckboxModule} from '@angular/material';
@NgModule({ imports: [ BrowserModule,MdButtonModule, MdCheckboxModule], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { }
` The log given by the failure.
Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
Full stack trace:
at Object.resolveEntryModuleFromMain (C:\Users\saish\Documents\my-app\node_modules@ngtools\webpack\src\entry_resolver.js:128:11) at AotPlugin._setupOptions (C:\Users\saish\Documents\my-app\node_modules@ngtools\webpack\src\plugin.js:138:50) at new AotPlugin (C:\Users\saish\Documents\my-app\node_modules@ngtools\webpack\src\plugin.js:23:14) at _createAotPlugin (C:\Users\saish\Documents\my-app\node_modules@angular\cli\models\webpack-configs\typescript.js:55:12) at Object.exports.getNonAotConfig (C:\Users\saish\Documents\my-app\node_modules@angular\cli\models\webpack-configs\typescript.js:70:19) at NgCliWebpackConfig.buildConfig (C:\Users\saish\Documents\my-app\node_modules@angular\cli\models\webpack-config.js:27:37) at Class.run (C:\Users\saish\Documents\my-app\node_modules@angular\cli\tasks\serve.js:37:98) at check_port_1.checkPort.then.port (C:\Users\saish\Documents\my-app\node_modules@angular\cli\commands\serve.js:103:26) at process._tickCallback (internal/process/next_tick.js:103:7)
npm ERR! Windows_NT 10.0.15063 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! node v7.2.0 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE npm ERR! [email protected] start:
ng servenpm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script 'ng serve'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the my-app package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ng serve npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs my-app npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls my-app npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! C:\Users\saish\Documents\my-app\npm-debug.log
Hi @saishbhende24, It is a bit confusing your code, nevertheless I would suggest you split the bootstrap code into a main.ts like 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);
I think It would work, if it doesn´t, if you could upload a repo, I could have a look
This issue does not appear to be CLI related, I'd suggest posting your question to a support-based forum such as StackOverflow or gitter.
I am having the same issue.
But in my case, trying to run angular 5 with electron. When I paste the code for main.js available at "https://electronjs.org/docs/tutorial/quick-start" and run "ng build --prod && electron .", I get this error "ERROR in Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
at Object.resolveEntryModuleFromMain (C:\Data\GitHub\intelectuais-client\node_modules@ngtools\webpack\src\entry_resolver.js:121:15)
at Promise.resolve.then.then (C:\Data\GitHub\intelectuais-client\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:240:54)
at
Same here @rafaelmelo007
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.