【问题标题】:Execute rails server from ruby app on Windows从 Windows 上的 ruby​​ 应用程序执行 rails server
【发布时间】:2013-01-28 22:21:29
【问题描述】:

我必须从 Ruby 脚本(版本 1.9.3)执行 Rails 服务器(Rails 版本:2.3.4,Ruby 版本:1.8.7)。 我的红宝石脚本是:

system(start G:/app/Ruby187/bin/ruby.exe G:/app/name_app/script/server)

当我启动这个脚本时,我得到了这个结果:

Missing the Rails 2.3.4 gem. Please `gem install -v=2.3.4 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

但是我在 ruby​​ 解释器 1.8.7 上安装了那个 gem。事实上,如果我在提示符下执行这个命令:

G:/app/Ruby187/bin/ruby.exe G:/app/name_app/script/server

Rails 服务器启动。 我检查了环境变量(因为我的脚本在 Ruby 193 上运行)但没有,输出是相同的错误。

你有什么想法吗?

【问题讨论】:

  • 试试这个system("G:/app/Ruby187/bin/ruby.exe G:/app/name_app/script/server")
  • 对不起,它不起作用,它的输出与脚本提示符相同。

标签: ruby-on-rails ruby ruby-on-rails-2 ruby-1.9.3


【解决方案1】:

是否定义了宝石的位置?

类似:

Set GEM_PATH=/Library/Ruby/Gems/1.8/:${GEM_PATH}

您会想查看您的主目录或根目录是否有 gem。你可以通过运行gem environment来做到这一点

(或)执行bundle installgem install rails 将解决您的问题。

(或)这将是rails问题,升级到rails 2.3.8

【讨论】:

  • 我想我们想在windows下~/.bash_profile~/.bashrcunix
  • 是的,它已定义。它是为目录/Ruby187/...中的Ruby1.8.7定义的,它是为目录/Ruby193/中的Ruby1.9.3定义的...谢谢
  • 您使用的机架版本是什么?卸载机架并重新安装最新的并让我们知道..
  • 我为 Ruby 1.9.3 使用 rack 1.1(release 1.4)。和 1.8.7.
猜你喜欢
  • 2015-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-08
  • 1970-01-01
  • 2016-08-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多