4

我已经安装了 thin 并尝试这样做thin start,最终出现此错误

C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/1.9/thin_parser (LoadError)
    from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/thin.rb:48:in `rescue in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/thin.rb:43:in `<top (required)>'
    from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/bin/thin:5:in `<top (required)>'
    from C:/Ruby192/bin/thin:19:in `load'
    from C:/Ruby192/bin/thin:19:in `<main>'

有人可以帮我吗,在此先感谢

4

2 回答 2

5

输出表示一个名为1.9ie的目录

<ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/1.9/

注意:我的瘦版本是 1.2.10。在下文中,我将使用系统上显示的路径。

由于某种原因,该目录没有附带薄 gem。但是一个名为的文件thin_parser.so位于父目录中<ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/

所以我的第一个解决方案是创建一个目录1.9并将文件 thin_parser.so 复制到它。现在thin start为我工作。

或者,您可以编辑文件<ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/thin.rb并更改

if Thin.win?
  # Select proper binary under Windows
  major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
  require "#{Thin::ROOT}/#{major_ruby_version}/thin_parser"
else
  require "#{Thin::ROOT}/thin_parser"
end

if Thin.win?
  # Select proper binary under Windows
  major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
  require "#{Thin::ROOT}/thin_parser"
else
  require "#{Thin::ROOT}/thin_parser"
end

甚至更简单

require "#{Thin::ROOT}/thin_parser"

我不确定哪种解决方法更好,因为我不知道薄文件在不存在的目录中还期望什么。我也不知道Thin.win在哪里?叉子变得很重要。

我决定支持第一个解决方案。但两种方式都为我解决了问题。

最好的问候,
蒂姆

于 2011-03-25T13:52:08.610 回答
0

我在运行时遇到了同样的错误rake db:migrate (我怀疑薄启动会给我同样的错误。)

我在 Amazon Linux 上运行(基于 rpm,与 CentOS 和 Redhat 非常相似)。我以前以 root 身份安装了瘦(gem install thin)。尽管它可能与您的情况无关,但为了完整起见,我还使用以下方法安装了 eventmachine:

gem install eventmachine --platform=ruby

这是我得到的错误:

% rake db:migrate
rake aborted!
LoadError: cannot load such file -- thin_parser
/home/rails/.gem/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
etc. etc.

根据以上信息,我在 strace 下运行 rake,发现它在错误的地方寻找 thin_parser.so。我能够通过安装这个符号链接来解决这个问题(我以 root 身份执行此操作,因为我以 root 身份安装了 thin)。显然,调整你的瘦版本的安装路径:

 cd /usr/local/share/gems1.9/gems/thin-1.6.3/lib
 ln -s ../ext/thin_parser/thin_parser.so .

噗! 那为我修好了。

于 2015-03-08T03:11:28.653 回答