我是AngularJS的新手,目前正在Ubuntu上构建一个应用程序。当我尝试使用npm install chart.js
安装 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 个漏洞。 您所说的错误只是WARN
表示警告,可以忽略,Chart.js
已成功安装。 你应该很高兴。
如果你想摆脱这些警告,正如它所说You must install peer dependencies yourself.
尝试 npm 安装jasmine-core@>=3.5
npm 决定添加一个新命令:npm fund,它将为 npm 用户提供更多可见性,了解哪些依赖项正在积极寻找资助其工作的方法。
npm install 还会在末尾显示一条消息,以便让用户知道依赖项正在寻找资金,它看起来像这样:
$ npm install
13 packages are looking for funding.
run `npm fund` for details.
运行 npm 基金将直接在您的浏览器中打开为该给定包列出的 URL。
NPM资助并不意味着软件包没有安装,你的软件包安装成功。
请查看此以获取更多信息
您没有收到任何错误,只有警告,您可以忽略它们。 首先,您可以从 https://github.com/jtblin/angular-chart.js 手动下载 但是您已经从 npm 安装了它们,因此请尝试将其包含在您的项目中
加载 Angular 模块时不要忘记使用
angular.module('myModule', ['chart.js']);
让我们知道您是否能够使用它,祝您好运!