Search code examples
angularwebpackangular-bootstrap

Can't run ng serve because of bootstrap?


I have a strange problem with Angular and none of my research was very useful.

I'm really new to this and started a little project where I added bootstrap to my Angular project. I followed a procedure (this one) and it worked well!

But today I tried to run the npm serve command and had the following error : Terminal Error img

I don't really get what's the error but found that the agular-cli.json file could be the key so here it is the important part.

  "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "./node_modules/bootstrap/dist/css/bootstrap.min.css",
        "styles.css"

I tried to replace the styles.css by src/styles.css but it didn't work.

The worst part is that it worked 2 or 3 days ago and I didn't do anything...


Solution

  • Your bootstrap styles path is wrong. Your styles entry should be:

    "styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
        "styles.css"
    ]