Thin LoadError:没有这样的文件来加载thin_parser

发布于 2024-10-25 17:00:17 字数 994 浏览 7 评论 0原文

我已经安装了 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>'

有人可以帮助我吗,提前致谢

I have installed thin and try to do thin start, which end up with this error

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>'

Can someone help me out please, thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

℡Ms空城旧梦 2024-11-01 17:00:17

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

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

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

由于某种原因,thin gem 不附带此目录。但名为 thin_parser.so 的文件位于父目录 /lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/

所以我的第一个解决方案是创建一个目录1.9并将文件thin_parser.so复制到其中。
现在thin start对我有用。

或者,您可以编辑文件 /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在哪里?叉子变得很重要。

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

谨致问候,
蒂姆

the output denotes a directory called 1.9 i.e.

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

Note: My thin version is 1.2.10. In the following i will use the path as it appears on my system.

For some reason the thin gem doesn't come with this directory. But a file called thin_parser.so resides in the parent directory <ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/

So my first solution was to create a directory 1.9 and copy the file thin_parser.so to it.
Now thin start works for me.

Alternatively you can edit the file <ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/thin.rb and change

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

to

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

or even simpler

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

I'm not sure what workaround is the better one, since i don't know what else files thin expects in the not existing directory. I don't know either where the Thin.win? fork becomes important.

I decided in favor of the first solution. But both ways fixed the Problem for me.

Best regards,
Tim

轻许诺言 2024-11-01 17:00:17

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

我在 Amazon Linux(基于 rpm,与 CentOS 和 Redhat 类似)上运行)。我之前已经以root身份安装了thin(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身份安装了thin,所以我以root身份执行了此操作)。显然,请将路径调整为您的 Thin 版本的安装位置:

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

噗!这为我解决了这个问题。

I ran into this same error when running rake db:migrate (I suspect thin start would have given me the same error.)

I'm running on Amazon Linux (rpm based, so similar to CentOS and Redhat). I had previously installed thin as root (gem install thin). Although it may be irrelevant to your situation, just for completeness, I had also installed eventmachine using:

gem install eventmachine --platform=ruby

Here is the error I got:

% 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.

Based on the above information, I ran rake under strace and discovered that it was looking for thin_parser.so in the wrong place. I was able to fix the problem by installing this symbolic link (I did this as root since I installed thin as root). Obviously, adjust the path to where your version of thin is installed:

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

Poof! That fixed it for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文