Module not found: Can't resolve 'chart.js' in /node_modules/ng2-charts/fesm2015

I am getting an error when running my application:

ERROR in ./node_modules/ng2-charts/fesm2015/ng2-charts.js
Module not found: Error: Can't resolve 'chart.js' in '/node_modules/ng2-charts/fesm2015'

I have installed ng2-charts via npm install --save ng2-charts. I am looking for help to understand why the error is thrown.

The following is my package.json file:

"dependencies": {
  "@angular/animations": "~8.2.9",
  "@angular/common": "~8.2.9",
  "@angular/compiler": "~8.2.9",
  "@angular/core": "~8.2.9",
  "@angular/fire": "^5.2.3",
  "@angular/forms": "~8.2.9",
  "@angular/platform-browser": "~8.2.9",
  "@angular/platform-browser-dynamic": "~8.2.9",
  "@angular/router": "~8.2.9",
  "@ngrx/store": "^8.6.0",
  "@ngrx/store-devtools": "^8.6.0",
  "bootstrap": "^4.4.1",
  "firebase": "^7.6.0",
  "ng2-charts": "^2.2.3",
  "rxjs": "~6.4.0",
  "sweetalert2": "^9.5.3",
  "tslib": "^1.10.0",
  "zone.js": "~0.9.1"
}

"devDependencies": {
  "@angular-devkit/build-angular": "^0.803.21",
  "@angular/cli": "~8.3.8",
  "@angular/compiler-cli": "~8.2.9",
  "@angular/language-service": "~8.2.9",
  "@types/jasmine": "~3.3.8",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "codelyzer": "^5.0.0",
  "jasmine-core": "~3.4.0",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~4.1.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~2.0.1",
  "karma-jasmine": "~2.0.1",
  "karma-jasmine-html-reporter": "^1.4.0",
  "protractor": "~5.4.0",
  "ts-node": "~7.0.0",
  "tslint": "~5.15.0",
  "typescript": "~3.5.3"
}

Error in browser:

I am getting the following error message in the browser:

ERROR in ./node_modules/ng2-charts/fesm2015/ng2-charts.js
Module not found: Error: Can't resolve 'chart.js' in '/node_modules/ng2-charts/fesm2015'

I have installed ng2-charts with npm install --save ng2-charts. I need help understanding why the error is being thrown.

My package.json file:

"dependencies": {
  "@angular/animations": "~8.2.9",
  "@angular/common": "~8.2.9",
  "@angular/compiler": "~8.2.9",
  "@angular/core": "~8.2.9",
  "@angular/fire": "^5.2.3",
  "@angular/forms": "~8.2.9",
  "@angular/platform-browser": "~8.2.9",
  "@angular/platform-browser-dynamic": "~8.2.9",
  "@angular/router": "~8.2.9",
  "@ngrx/store": "^8.6.0",
  "@ngrx/store-devtools": "^8.6.0",
  "bootstrap": "^4.4.1",
  "firebase": "^7.6.0",
  "ng2-charts": "^2.2.3",
  "rxjs": "~6.4.0",
  "sweetalert2": "^9.5.3",
  "tslib": "^1.10.0",
  "zone.js": "~0.9.1"
}

"devDependencies": {
  "@angular-devkit/build-angular": "^0.803.21",
  "@angular/cli": "~8.3.8",
  "@angular/compiler-cli": "~8.2.9",
  "@angular/language-service": "~8.2.9",
  "@types/jasmine": "~3.3.8",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "codelyzer": "^5.0.0",
  "jasmine-core": "~3.4.0",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~4.1.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~2.0.1",
  "karma-jasmine": "~2.0.1",
  "karma-jasmine-html-reporter": "^1.4.0",
  "protractor": "~5.4.0",
  "ts-node": "~7.0.0",
  "tslint": "~5.15.0",
  "typescript": "~3.5.3"
}

I am getting the following error when running my application:

ERROR in ./node_modules/ng2-charts/fesm2015/ng2-charts.js
Module not found: Error: Can't resolve 'chart.js' in '/node_modules/ng2-charts/fesm2015'

I have installed ng2-charts using npm install --save ng2-charts, and I am looking for help to understand why this error is being thrown. Below is my package.json file:

"dependencies": {
  "@angular/animations": "~8.2.9",
  "@angular/common": "~8.2.9",
  "@angular/compiler": "~8.2.9",
  "@angular/core": "~8.2.9",
  "@angular/fire": "^5.2.3",
  "@angular/forms": "~8.2.9",
  "@angular/platform-browser": "~8.2.9",
  "@angular/platform-browser-dynamic": "~8.2.9",
  "@angular/router": "~8.2.9",
  "@ngrx/store": "^8.6.0",
  "@ngrx/store-devtools": "^8.6.0",
  "bootstrap": "^4.4.1",
  "firebase": "^7.6.0",
  "ng2-charts": "^2.2.3",
  "rxjs": "~6.4.0",
  "sweetalert2": "^9.5.3",
  "tslib": "^1.10.0",
  "zone.js": "~0.9.1"
}

"devDependencies": {
  "@angular-devkit/build-angular": "^0.803.21",
  "@angular/

The error is being thrown because the ng2-charts package is unable to find the chart.js dependency. To fix this, you need to install chart.js as well. You can do this by running the following command:

npm install --save chart.js

After installing chart.js, try running your application again and the error should be resolved.