Angular-cli: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options

Created on 6 Feb 2018  Â·  6Comments  Â·  Source: angular/angular-cli

When I remove node_modules and run npm install after that ng serve I've got 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 ("my
local path") at Promise.resolve.then.then ("my local path") at
process._tickCallback (internal/process/next_tick.js:109:7)

My packege.json is:

{
    "name": "bib.web-client",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "common": "ng serve -o -app common",
        "aml": "ng serve -o -app aml",
        "conncus": "ng serve -o -app connected-customers",
        "salaries": "ng serve -o -app salaries"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "^5.0.1",
        "@angular/cdk": "^5.0.0-rc0",
        "@angular/common": "^5.0.1",
        "@angular/compiler": "^5.0.1",
        "@angular/core": "^5.0.1",
        "@angular/forms": "^5.0.1",
        "@angular/http": "^5.0.1",
        "@angular/material": "^5.0.0-rc0",
        "@angular/platform-browser": "^5.0.1",
        "@angular/platform-browser-dynamic": "^5.0.1",
        "@angular/router": "^5.0.1",
        "@swimlane/ngx-datatable": "^11.0.3",
        "@types/jquery": "^3.2.16",
        "bootstrap": "^3.3.7",
        "classlist.js": "^1.1.20150312",
        "core-js": "^2.5.1",
        "intl": "^1.2.5",
        "jquery": "^3.2.1",
        "jshint": "^2.9.5",
        "linqts": "^1.10.0",
        "ng2-bootstrap": "^1.6.3",
        "ng2-select": "^2.0.0",
        "ng2-table": "^1.3.2",
        "ngx-bootstrap": "^2.0.0-beta.8",
        "ngx-tabset": "^1.2.0",
        "rxjs": "^5.5.2",
        "ts-lint": "^4.5.1",
        "web-animations-js": "^2.3.1",
        "zone.js": "^0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^1.6.4",
        "@angular/compiler-cli": "^5.0.1",
        "@angular/language-service": "^5.0.1",
        "@types/jasmine": "~2.8.2",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "^8.0.50",
        "codelyzer": "~4.0.1",
        "jasmine-core": "~2.8.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~1.7.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-cli": "~1.0.1",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "ng2-datepicker": "^2.1.3",
        "ng2-validation": "^4.0.0",
        "protractor": "~5.2.0",
        "ts-node": "~3.3.0",
        "tslint": "~5.8.0",
        "typescript": "^2.6.1",
        "webpack": "^3.10.0"
    }
}
RFC / discussion / question

Most helpful comment

this is really a headache i have trid almost everything i could think of but still same 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." let see how many days its gonna be a problem for people like me , FYI i am on it

All 6 comments

Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information.

Please provide the actual output of ng --version; also, based on the information provided, the content of the project's .angular-cli.json and main.ts may prove useful.

ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.6
Node: 6.11.2
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.0-rc0
@angular/cli: 1.6.6
@angular/material: 5.0.0-rc0
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.6
@schematics/angular: 0.1.17
typescript: 2.6.1
webpack: 3.10.0

angular-cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "bib.web-client"
  },
  "apps": [
    {
      "name": "main",
      "root": "src",
      "outDir": "dist/main",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "gang",
      "styles": [
        "styles.css",
        "../node_modules/bootstrap/dist/css/bootstrap.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    },
    {
      "name": "common",
      "appRoot": ".",
      "root": "src/app/common",
      "outDir": "dist/common",
      "assets": [{
          "glob": "**/*",
          "input": "../../assets/",
          "output": "./assets",
          "allowOutsideOutDir": false
        },
        {
          "glob": "favicon.ico",
          "input": "../../",
          "output": "",
          "allowOutsideOutDir": false
        },
        {
          "glob": "appSettings.json",
          "input": "",
          "output": "",
          "allowOutsideOutDir": false
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "../../polyfills.ts",
      "tsconfig": "../../tsconfig.app.json",
      "prefix": "common",
      "styles": [
        "../../styles.css",
        "../../../node_modules/bootstrap/dist/css/bootstrap.css"
      ],
      "scripts": [],
      "environmentSource": "../../environments/environment.ts",
      "environments": {
        "dev": "../../environments/environment.ts",
        "prod": "../../environments/environment.prod.ts"
      }
    },
    {
      "name": "aml",
      "appRoot": ".",
      "root": "src/app/aml",
      "outDir": "dist/aml",
      "assets": [{
          "glob": "**/*",
          "input": "../../assets/",
          "output": "./assets",
          "allowOutsideOutDir": false
        },
        {
          "glob": "favicon.ico",
          "input": "../../",
          "output": "",
          "allowOutsideOutDir": false
        },
        {
          "glob": "appSettings.json",
          "input": "",
          "output": "",
          "allowOutsideOutDir": false
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "../../polyfills.ts",
      "tsconfig": "../../tsconfig.app.json",
      "prefix": "aml",
      "styles": [
        "../../styles.css",
        "../../../node_modules/bootstrap/dist/css/bootstrap.css"
      ],
      "scripts": [],
      "environmentSource": "../../environments/environment.ts",
      "environments": {
        "dev": "../../environments/environment.ts",
        "prod": "../../environments/environment.prod.ts"
      }
    },
    {
      "name": "connected-customers",
      "appRoot": ".",
      "root": "src/app/connected-customers",
      "outDir": "dist/connected-customers",
      "assets": [{
          "glob": "**/*",
          "input": "../../assets/",
          "output": "./assets",
          "allowOutsideOutDir": false
        },
        {
          "glob": "favicon.ico",
          "input": "../../",
          "output": "",
          "allowOutsideOutDir": false
        },
        {
          "glob": "appSettings.json",
          "input": "",
          "output": "",
          "allowOutsideOutDir": false
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "../../polyfills.ts",
      "tsconfig": "../../tsconfig.app.json",
      "prefix": "conncus",
      "styles": [
        "../../styles.css",
        "../../../node_modules/bootstrap/dist/css/bootstrap.css"
      ],
      "scripts": [],
      "environmentSource": "../../environments/environment.ts",
      "environments": {
        "dev": "../../environments/environment.ts",
        "prod": "../../environments/environment.prod.ts"
      }
    },
    {
      "name": "salaries",
      "appRoot": ".",
      "root": "src/app/salaries",
      "outDir": "dist/salaries",
      "assets": [{
          "glob": "**/*",
          "input": "../../assets/",
          "output": "./assets",
          "allowOutsideOutDir": false
        },
        {
          "glob": "favicon.ico",
          "input": "../../",
          "output": "",
          "allowOutsideOutDir": false
        },
        {
          "glob": "appSettings.json",
          "input": "",
          "output": "",
          "allowOutsideOutDir": false
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "../../polyfills.ts",
      "tsconfig": "../../tsconfig.app.json",
      "prefix": "sal",
      "styles": [
        "../../styles.css",
        "../../../node_modules/bootstrap/dist/css/bootstrap.css"
      ],
      "scripts": [],
      "environmentSource": "../../environments/environment.ts",
      "environments": {
        "dev": "../../environments/environment.ts",
        "prod": "../../environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [{
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  },
  "warnings": {
    "typescriptMismatch": false
  }
}

main.ts

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

Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

this is really a headache i have trid almost everything i could think of but still same 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." let see how many days its gonna be a problem for people like me , FYI i am on it

I have the same problem trying to build this sample project from the angular universal guide (v5) .

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._

Was this page helpful?
0 / 5 - 0 ratings