F
F
Fredik4872021-05-05 22:29:55
Angular
Fredik487, 2021-05-05 22:29:55

Angular 11: Error running ng serve command. How to decide?

Angular version 11, an error pops up when running the command ng serve

"An unhandled exception occurred: ENOENT: no such file or directory, lstat '/home/v4l1k/Work/Practice/node_modules' "

I have already tried updating dependencies and removing node_modules and reinstalling, and clear cache, nothing helps.

package.json

{
  "name": "practice-app-auth",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^11.2.12",
    "@angular/common": "^11.2.12",
    "@angular/compiler": "^11.2.12",
    "@angular/core": "^11.2.12",
    "@angular/forms": "^11.2.12",
    "@angular/platform-browser": "^11.2.12",
    "@angular/platform-browser-dynamic": "^11.2.12",
    "@angular/router": "^11.2.12",
    "jquery": "^3.6.0",
    "json-server": "^0.16.3",
    "popper.js": "^1.16.1",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1102.11",
    "@angular/cli": "^11.2.11",
    "@angular/compiler-cli": "^11.2.12",
    "@types/jasmine": "^3.6.11",
    "@types/node": "^12.20.12",
    "bootstrap": "^4.6.0",
    "codelyzer": "^6.0.2",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.1.5"
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fredik487, 2021-05-05
@Fredik487

I solved the problem, it turns out the wrong path was in styles in Package.json
Was

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

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question