Closed alier1226 closed 6 years ago
@alier1226 首先是否正确安装了echarts?理论上说不会出现该错误。方便的话,你可以new一个新的demo项目给到我,然后按你现在项目的配置复现一下问题。我自己的项目里面没能够复现这个
@xieziyu 就是很普通的跑了yarn add echarts。package.json
里:"echarts": "^4.1.0", "ngx-echarts": "2.1.0"。我看了一下angular6的话可以global add scripts to unit tests,但没找到v1.x版本的信息。打算等同事把所有东西升级到6然后再看看有没有相同的问题。谢谢
您好, 我用的是angular-cli (v1.7.4), 在scripts里面放了
“../node_modules/echarts/dist/echarts.min.js”
。ng serve
的时候没有任何问题,但是一跑unit test就不行了,出现echarts in not defined
的错误,请问有解决的方法吗?我的spec.ts
是angular自己生成的,还没有写任何真正的test,唯一的修改就是import了NgxEchartsModule
谢谢
ReferenceError: echarts is not defined at http://localhost:9876/_karma_webpack_/webpack:/node_modules/ngx-echarts/ngx-echarts.es5.js:95:1 at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:388:1) at ProxyZoneSpec.webpackJsonp../node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke node_modules/zone.js/dist/proxy.js:128:1) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:387:1) at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.run node_modules/zone.js/dist/zone.js:138:1) at NgZone.webpackJsonp../node_modules/@angular/core/esm5/core.js.NgZone.runOutsideAngular node_modules/@angular/core/esm5/core.js:4708:48) at NgxEchartsDirective.webpackJsonp../node_modules/ngx-echarts/ngx-echarts.es5.js.NgxEchartsDirective.createChart node_modules/ngx-echarts/ngx-echarts.es5.js:94:1) at NgxEchartsDirective.webpackJsonp../node_modules/ngx-echarts/ngx-echarts.es5.js.NgxEchartsDirective.onOptionsChange node_modules/ngx-echarts/ngx-echarts.es5.js:143:1) at SafeSubscriber._next node_modules/ngx-echarts/ngx-echarts.es5.js:118:1)