简体   繁体   English

运行 ng build 时使用 ngx-charts 出现错误

[英]using ngx-charts when run ng build got error

installed ngx-chart 12.0.1 angular 11安装 ngx-chart 12.0.1 angular 11

when run ng build, got this error: Field 'browser' doesn't contain a valid alias configuration using description file: C:\wwwroot\ngxchart\package.json (relative path: ./src/main/webapp/resources/typescript/aot/node_modules/@swimlane/ngx-charts/release/common/charts/chart.component)运行 ng build 时,出现此错误:字段“浏览器”不包含使用描述文件的有效别名配置:C:\wwwroot\ngxchart\package.json(相对路径:./src/main/webapp/resources/typescript /aot/node_modules/@swimlane/ngx-charts/release/common/charts/chart.component)

expected no error预期没有错误

You need to look up what version of support for angular is supported when downloading packages.下载包的时候需要查一下支持angular支持什么版本。 the one you download is only for angular 7-8 and hence would cause issues with rendering due to the render engine back then was using ViewEngine and i beleave in angular 11 you already on ivy.您下载的那个仅适用于 angular 7-8,因此会导致渲染问题,因为当时的渲染引擎使用的是 ViewEngine,我相信 angular 11 你已经在常春藤上了。

for angular you need version 18.0.1 of ngx-charts对于 angular,您需要 ngx-charts 版本 18.0.1

npm i @swimlane/ngx-charts@18.0.1

you can see the requirements in their package.json so for 12.0.1 the versions are angular 7 and 8 for 18.0.x its angular 11 which you use based on what you wrote.您可以在他们的 package.json 中看到要求,因此对于 12.0.1,版本为 angular 7,对于 18.0.x,其版本为 8 angular 11,您根据自己编写的内容使用。 https://github.com/swimlane/ngx-charts/blob/18.0.1/package.json https://github.com/swimlane/ngx-charts/blob/18.0.1/package.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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