ECharts 3D React umi 报错:Component series.surface not exists. Load it first

React 的 Umi项目,在使用 Echarts 3D 时报错:Error: Component series.surface not exists. Load it first.

报错原因

Echarts 3D 还需要依赖 echarts-gl 

解决方法

npm 安装 echarts-gl 依赖:

npm install echarts-gl --save

我安装又报了个错:

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: shared-operation-big-screen@undefined
npm ERR! Found: echarts@4.9.0
npm ERR! node_modules/echarts
npm ERR!   dev echarts@"^4.9.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer echarts@"^5.1.2" from echarts-gl@2.0.9
npm ERR! node_modules/echarts-gl
npm ERR!   echarts-gl@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Deshun\AppData\Local\npm-cache\eresolve-report.txt for a full report.

是因为新版的 echarts-gl@2.0.9 对应最低 Echarts 版本是 5.1.2,我用的是 Echarts 4.9.0 版本,对应的是 1.1.2 版本的 echarts-gl

npm 安装对应版本的 echarts-gl:

npm install echarts-gl@1.1.2 --save

在项目先引入:

import 'echarts-gl';

重新运行项目,问题解决。

未经允许不得转载:Web前端开发资源网 » ECharts 3D React umi 报错:Component series.surface not exists. Load it first

推荐阅读:

HTML引入文件的绝对路径、相对路径、根目录

CSS3中元素背景的 gradient 渐变属性

WDLinux故障 Linux系统网站数据备份笔记

Jetbrains系列激活补丁JetbrainsCrack-2.8更新

Jetbrains系列激活补丁JetbrainsCrack-2.10更新

赞 (0)
分享到: +

评论 沙发

Avatar

换个身份

  • 昵称 (必填)
  • 邮箱 (选填)