简体   繁体   中英

How to include Chart.js in my AngularJS project?

I'm new to AngularJS and I'm currently working on building an application on Ubuntu. When I'm trying to install Chart.js using npm install chart.js , it is throwing the following error .

 npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/karma/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@angular/compiler-cli/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) + chart.js@2.9.3 updated 1 package and audited 19058 packages in 9.013s 23 packages are looking for funding run `npm fund` for details found 0 vulnerabilities

What does this error mean?

How do I fix this?

Is there any other way to include Chart.js in my project other than the install command?

There are 0 vulnerabilities in your install. what you call error is just WARN means warnings, which can be ignored, Chart.js has successfully installed. you should be good to go.

If you want to get rid of these warnings, as it says You must install peer dependencies yourself.

Try npm install jasmine-core@>=3.5

npm decided to add a new command: npm fund that will provide more visibility to npm users on what dependencies are actively looking for ways to fund their work.

npm install will also show a single message at the end in order to let user aware that dependencies are looking for funding, it looks like this:

$ npm install
13 packages are looking for funding.
run `npm fund` for details.

Running npm fund will open the url listed for that given package right in your browser.

npm funding does not mean that the package is not installed, your package is successfully installed.

please check this for more information

you didnt get any errors only warnings, you can ignore them. first of all you can download manually from https://github.com/jtblin/angular-chart.js but you already installed them from npm so try to include it in your project

when you load your angular module dont forget to use

angular.module('myModule', ['chart.js']);

let us know if you were able to use it, best of luck !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM