Ruby on Rails搭建环境出现的问题及解决方案

时间:2021-08-23 12:26:08

问题一:在win7系统64位环境下执行cmd命令:rails new testapp 之后,回报如下图错误:Gem:installer::ExtensionBuildError: ERROR:Failed to build gem native extension.

Ruby on Rails搭建环境出现的问题及解决方案

解决办法:1:卸载当前gemrails,卸载devkit。之后先装devkit再装rails。

      结果不成功:

      Ruby on Rails搭建环境出现的问题及解决方案

解决办法:2:卸载ruby,重新装。

      参照官网http://www.rubyinstaller.org/downloads/,这次选择Ruby 1.9.3安装包。devkit选择tdm-32-4.5.2。最后安装rails: 执行gem install rails。

      结果安装成功,没有报错。

注:ruby官网部分解释:

Which version to download?

If you don’t know what version to install and you’re getting started with Ruby, we recommend you use Ruby 1.9.3 installers. These provide a stable language and a extensive list of packages (gems) that are compatible and updated.

如果你刚接触Ruby且不知道选择什么样的版本,我们建议您用Ruby 1.9.3安装包。

Ruby 2.0.0, specially the 64bits version, are relatively new on the Windows area and not all the packages have been updated to be compatible with it. To use this version you will require some knowledge about compilers and solving dependency issues, which might be too complicated if you just want to play with the language.

Users of CPUs older than Intel’s Nocona (90nm Pentium 4) who wish to use Ruby 2.0.0 will need to build their own using a different DevKit by following these instructions.

Which Development Kit?

Down this page, several and different versions of Development Kits (DevKit) are listed. Please download the right one for your version of Ruby:

  • Ruby 1.8.6 to 1.9.3: tdm-32-4.5.2
  • Ruby 2.0.0: mingw64-32-4.7.2
  • Ruby 2.0.0 x64 (64bits): mingw64-64-4.7.2