2015-12-08 98 views
0

大家好我是新来的rails我跟随lynda教程,我正在尝试安装mysql2,但错误显示我已经看到堆栈溢出的各种页面,但无法解决它。我的错误是
在windows上安装Rails mysql2

ERROR: Could not find a valid gem 'mysql2' (>= 0), here is why: 
      Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/latest_specs.4.8.gz) 
+0

它被列出_https://rubygems.org/gems/mysql2_ ...也许你还没有试图调用:gem install mysql2,但包含引号'mysql2'。尝试没有 – benjamin

回答

-2

我认为这是在你的Gemfile一些拼写错误,请检查您是否有在本教程中提到的类型是正确的版本。 MySQL的宝石应该看起来像下面。

gem 'mysql2', '~> 0.3.11' 
0

在Windows上,你需要use the following

gem install mysql2 --platform=ruby -- --with-mysql-dir="C:/path/to/your/c-connector/install/no/spaces"

这应该安装宝石,允许您继续进行其他安装。

-

的原因,这必须要在Windows上做的是,由于该mysql2宝石需要一个外部的依赖集(的c-connector插件),其中Windows没有默认安装的事实。

Linux用户可以使用apt-get和Mac用户brew来获得依赖关系; Windows用户必须自行下载。

如果您按照上述步骤操作,您应该安装mysql2 gem。