Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find type definition file for 'highcharts'

I followed the installation and example from https://www.npmjs.com/package/angular-highcharts however, I get the error:

ERROR in node_modules/angular-highcharts/chart.d.ts(1,23): error TS2688: Cannot find type definition file for 'highcharts'.

I'm working with angular-cli:

Angular CLI: 1.6.0
Node: 9.3.0
OS: darwin x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

app.module.ts:

...
import {ChartComponent} from "./chart/chart.component";
import {ChartModule} from "angular-highcharts";


@NgModule({
            declarations: [
              AppComponent,
              BatteryChargingDetailsComponent,
              ChartComponent
            ],
            imports: [
              BrowserModule,
              HttpClientModule,
              ChartModule,
              FormsModule,
              ReactiveFormsModule,
              MultiselectDropdownModule,
              RouterModule.forRoot(ROUTES)
            ],
            providers: [
              AuthService
            ],
            bootstrap: [AppComponent]
          })
export class AppModule {
  private static NgxAdminLteModule: any;
}

package.json

{
  "name": "revolts-web",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:prod:pre": "rm -rf dist && node ./replace.build.js",
    "build:prod:auto-version": "npm version patch && npm run build:prod:pre",
    "build:prod:build": "ng build --prod",
    "build:prod:package": "cd dist && zip -r orcas-ui-$npm_package_version.zip .",
    "build:prod": "npm run build:prod:pre && npm run build:prod:build && npm run build:prod:package"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "admin-lte": "^2.4.2",
    "angular-2-dropdown-multiselect": "^1.6.3",
    "angular-admin-lte": "^0.2.5",
    "angular-auth0": "^3.0.0",
    "angular-highcharts": "^5.2.0",
    "highcharts": "^6.0.4",
    "auth0-js": "^9.0.2",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.6.0",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }
}

After googling a bit I found that some one has added "@types/highcharts": "^5.0.12" to "dependencies" in package.json. .. and after npm install ng serve -> no errors here.

on google console I get:

scripts.bundle.js:11 Uncaught Error: Highcharts error #16: www.highcharts.com/errors/16
    at Object.a.error (scripts.bundle.js:11)
    at eval (highcharts.js:8)
    at eval (highcharts.js:9)
    at eval (highcharts.js:8)
    at eval (highcharts.js:8)
    at Object.../../../../highcharts/highcharts.js (vendor.bundle.js:336)
    at __webpack_require__ (inline.bundle.js:55)
    at eval (angular-highcharts.es5.js:8)
    at Object.../../../../angular-highcharts/angular-highcharts.es5.js (vendor.bundle.js:39)
    at __webpack_require__ (inline.bundle.js:55)
a.error @ scripts.bundle.js:11
(anonymous) @ highcharts.js:8
(anonymous) @ highcharts.js:9
(anonymous) @ highcharts.js:8
(anonymous) @ highcharts.js:8

where is my issue here?

like image 727
Pascal Avatar asked Jan 12 '18 08:01

Pascal


1 Answers

npm install --save @types/highcharts

like image 151
asiop Avatar answered Nov 17 '22 11:11

asiop