Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: echarts is not defined #10

Closed
Jmarisa opened this issue Jun 28, 2017 · 7 comments
Closed

ReferenceError: echarts is not defined #10

Jmarisa opened this issue Jun 28, 2017 · 7 comments

Comments

@Jmarisa
Copy link

Jmarisa commented Jun 28, 2017

When I run the page with the chart, it gives me this error:

captura de ecra 2017-06-28 as 15 52 29

(I'm importing the script on angular-cli)

Any ideas?

@xieziyu
Copy link
Owner

xieziyu commented Jun 29, 2017

@Jmarisa

  1. check if you have correctly installed echarts and imported in .angular-cli.json
  2. check if your project is involved with other module resolver, such as webpack or systemjs

@lihuabest
Copy link

lihuabest commented Jul 8, 2017

我也存在这个问题,换了好多echarts版本 都不行。angular-cli.json里确定是加入了echarts的 死活找不到原因

重新测试发现可能是angular的版本原因,angular-cli新生成的项目都是可以运行的,angular对应版本是2.4.0,但是自己项目已经和官方一致是4.2.2了

再补充一下,可以修改angular-cli@1.1.2的配置来解决问题。修改node_modules/@angular/cli/models/webpack-configs/common.js
plugins: [ // 新增这个 new webpack.ProvidePlugin({ echarts: 'echarts' }) ]

@shao37142
Copy link

我也有这个问题...想请教一下,我安装完毕之后ngx-echarts这个文件的directive里面没有angular-echarts.directive..ts文件...但是有一个angular-echarts.directive.d.ts...里面export了AngularEchartsDirective,里面的代码和你的angular-echarts.directive.ts的差很多...所以...怎么办...

@xieziyu
Copy link
Owner

xieziyu commented Jul 24, 2017

@shao37142 安装后的目录ngx-echarts目录里面,你不需要关心directive目录。
按照README中的说明,根据你的项目类型修改配置即可。

@shao37142
Copy link

@xieziyu 主要我是小白...想搞明白这个包到底是个什么原理...弄好了,感谢...

@xieziyu xieziyu closed this as completed Sep 28, 2017
@liusongge
Copy link

在node_modules里新增这个 new webpack.ProvidePlugin({ echarts: 'echarts' }) 的话别人如果下代码更改 每次都要在node里添加这个啊。。 有没有其他的方法可以解决呢

@liusongge
Copy link

@lihuabest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants