簡體   English   中英

如何在我的 AngularJS 項目中包含 Chart.js?

[英]How to include Chart.js in my AngularJS project?

我是 AngularJS 的新手,目前正在 Ubuntu 上構建應用程序。 當我嘗試使用npm install chart.js時,它拋出以下錯誤

 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

這個錯誤是什么意思?

我該如何解決?

除了安裝命令之外,還有其他方法可以在我的項目中包含 Chart.js 嗎?

您的安裝中存在 0 個漏洞。 what you call error is just WARN means warnings, which can be ignored, Chart.js已成功安裝。 你應該可以開始了。

如果你想擺脫這些警告,正如它所說, You must install peer dependencies yourself.

嘗試 npm install jasmine-core@>=3.5

npm 決定添加一個新命令:npm fund,這將為 npm 用戶提供更多可見性,讓他們了解哪些依賴項正在積極尋找為他們的工作提供資金的方法。

npm install 也會在最后顯示一條消息,以便讓用戶知道依賴項正在尋找資金,它看起來像這樣:

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

運行 npm fund 將在您的瀏覽器中打開為該給定包列出的 url。

npm 資助並不意味着沒有安裝包,你的包安裝成功了。

請檢查此以獲取更多信息

你沒有收到任何錯誤警告,你可以忽略它們。 首先,您可以從https://github.com/jtblin/angular-chart.js手動下載,但您已經從 npm 安裝了它們,因此請嘗試將其包含在您的項目中

當你加載你的角度模塊時,不要忘記使用

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

如果您能夠使用它,請告訴我們,祝您好運!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM