本文介绍了使用gchart(googlecharts)时出错gem - NameError:未初始化的常量Gchart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装了它:
sudo gem install googlecharts
I installed it with:sudo gem install googlecharts
它安装的很好,但每当我尝试使用它时,我都会得到:
NameError:未初始化的常量Gchart
It installed fine, but whenever I try to use it I get:NameError: uninitialized constant Gchart
以下是我正在运行的代码:
Here is the code I am running:
$ irb
>> require 'gchart'
=> true
>> Gchart.line(:data => [0, 40, 10, 70, 20])
NameError: uninitialized constant Gchart
from (irb):2
推荐答案
羽衣甘蓝,我也有这个问题。还有另一个名为gchart的gem,它与googlecharts相冲突,因为它们都在Ruby中使用名称'gchart'。您需要卸载gchart:gem卸载gchart,并可能重新安装googlecharts。
Kale, I had this problem too. There's another gem called gchart which conflicts with googlecharts as they both use the name 'gchart' in Ruby. You need to uninstall gchart: gem uninstall gchart and potentially reinstall googlecharts.
这篇关于使用gchart(googlecharts)时出错gem - NameError:未初始化的常量Gchart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!