angularplotlyplotly.js

Error: Unexpected value "PlotlyViaCDNModule" imported by the module 'AppModule'. Please add an @NgModule annotation


I recently upgraded to angular major version 16 and trying to upgrade plotlyJS along with other libraries.

I ran the commands

npm install angular-plotly.js plotly.js-dist-min --save
npm install @types/plotly.js-dist-min --save-dev

Yet, my vscode window seems to underline the imports in red.. enter image description here

Heres my list of installed libs:

├── @angular-devkit/build-angular@16.2.11
├── @angular/animations@16.2.12
├── @angular/cdk@16.2.12
├── @angular/cli@16.2.11
├── @angular/common@16.2.12
├── @angular/compiler-cli@16.2.12
├── @angular/compiler@16.2.12
├── @angular/core@16.2.12
├── @angular/forms@16.2.12
├── @angular/language-service@16.2.12
├── @angular/localize@16.2.12
├── @angular/material@16.2.12
├── @angular/platform-browser-dynamic@16.2.12
├── @angular/platform-browser@16.2.12
├── @angular/router@16.2.12
├── @popperjs/core@2.11.2
├── @types/d3@7.4.0
├── @types/jasmine@3.6.11
├── @types/jasminewd2@2.0.10
├── @types/jquery@3.5.14
├── @types/luxon@3.3.0
├── @types/node@8.9.5
├── @types/plotly.js-dist-min@2.3.4
├── angular-plotly.js@4.0.4
├── codelyzer@6.0.2
├── d3@7.3.0
├── express@4.17.3
├── file-saver@2.0.5
├── html-to-pdfmake@2.4.4
├── jasmine-core@3.8.0
├── jasmine-spec-reporter@5.0.2
├── jquery@3.6.0
├── jspdf@2.5.1
├── karma-chrome-launcher@3.1.0
├── karma-coverage-istanbul-reporter@2.0.6
├── karma-jasmine-html-reporter@1.7.0
├── karma-jasmine@4.0.1
├── karma@6.3.17
├── keyboard-css@1.2.4
├── less@4.1.3
├── ng-zorro-antd@16.2.2
├── ngx-color-picker@16.0.0
├── ngx-cookie-service@16.1.0
├── ngx-json-viewer@3.2.1
├── npm@8.19.3
├── pdfmake@0.2.8
├── plotly.js-dist-min@2.27.1
├── protractor@7.0.0
├── rxjs@7.8.1
├── ts-node@7.0.1
├── tslib@2.6.2
├── tslint@6.1.3
├── typescript@5.1.6
├── webpack-dev-server@4.15.1
└── zone.js@0.13.3

Project seems to compile fine with

ng serve

No complains about library missing there. But in the browser: enter image description here

Any input is welcome, thanks.


Solution

  • I ended up uninstalling and reinstalling the libraries. This solved the issue.