Garima Kinra
Garima Kinra

Reputation: 1

ng serve command prompting error 549 in Angular 2 project

I have tried with all given solutions like updating angular/cli and even uninstalling and reinstalling node/npm. I can create new project and it works as expected but when I am trying run ng serve command on my existing project it is showing me below error. Please help to resolve this.

module.js:549 throw error; ^
Error: Cannot find module './template' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (E:\Project\Nitesh\AngularMergedCode\AngularDemo\node_modules\@angular-devkit\core\src\utils\index.js:19:10) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) PS E:\Project\Nitesh\AngularMergedCode\AngularDemo> npm update PS E:\Project\Nitesh\AngularMergedCode\AngularDemo> ng serve

Package.json file :

{
  "name": "offica-replica",
  "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": {
    "@agm/core": "^1.0.0-beta.3",
    "@angular-devkit/build-angular": "^0.6.8",
    "@angular/animations": "^6.0.9",
    "@angular/common": "^6.0.9",
    "@angular/compiler": "^6.0.9",
    "@angular/core": "^6.0.9",
    "@angular/forms": "^6.0.9",
    "@angular/http": "^6.0.9",
    "@angular/platform-browser": "^6.0.9",
    "@angular/platform-browser-dynamic": "^6.0.9",
    "@angular/router": "^6.0.9",
    "core-js": "^2.5.4",
    "ngx-infinite-scroll": "^6.0.1",
    "ngx-pagination": "^3.1.1",
    "ngx-spinner": "^6.0.0",
    "ngx-toastr": "^8.9.1",
    "rxjs": "^6.2.2",
    "rxjs-compat": "^6.2.2",
    "template": "^0.17.5",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^6.0.9",
    "@angular/language-service": "^6.0.9",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

Upvotes: 0

Views: 323

Answers (1)

Garima Kinra
Garima Kinra

Reputation: 1

I resolved this problem, It was a missing module problem so i need to perform these 2 steps:

1.Remove node_modules folder from project directory.

  1. Run command npm install (This will reinstall all missing modules)

    After this ng serve command works fine.

Upvotes: 0

Related Questions