安装rails时出错,缺少ruby.exe

时间:2016-07-15 04:40:38

标签: ruby-on-rails

所以我尝试使用railsinstaller.org的RailsInstaller将Rails安装到我的Windows。

一切正常,直到我使用'gem install rails'并弹出此错误代码:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

current directory: D:/Misc/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/nio4r-1.2.1/ext/nio4r
D:/Misc/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160715-720-115hc2e.rb extconf.rb
D:/Misc/RailsInstaller/Ruby2.2.0/bin/ruby.exe: No such file or directory --extconf.rb (LoadError)

extconf failed, exit code 1

Gem files will remain installed in D:/Misc/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/nio4r-1.2.1 for inspection.
Results logged to D:/Misc/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/nio4r-1.2.1/gem_make.out

即使安装了x64版本,错误仍然存​​在。

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

current directory: D:/Misc/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
D:/Misc/Ruby23-x64/bin/ruby.exe -r ./siteconf20160715-7956-15ui18c.rb extconf.rb
D:/Misc/Ruby23-x64/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)

extconf failed, exit code 1

Gem files will remain installed in D:/Misc/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1 for inspection.
Results logged to D:/Misc/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/nio4r-1.2.1/gem_make.out

我检查了所说的目录,文件肯定在那里。我已经尝试重新安装,结果是一样的。此外,我知道堆栈溢出周围有很多类似的问题,但它们似乎都没有对这个问题有帮助,所以请原谅我。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

啊,可能是一些事情。在我的头顶:

  1. 当您需要64位时,您是否意外安装了32位版本的Ruby或Rails?
  2. 环境变量路径中是D:/Misc/RailsInstaller/Ruby2.2.0/bin/ruby.exe的链接? Environment variable path
  3. 您是否正在安装与Windows无法正常运行的Rails Gem版本?或您当前的系统设置。可能值得尝试gem install rails -v 4.1.8(适用于我的Windows设置)或其他特定版本,看看是否有效。