Thin LoadError: no such file to load thin_parser

I installed thin and try to make thin start , resulting in 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 please thanks in advance

+4
source share
2 answers

output denotes a directory named 1.9 ie

<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 in my system.

For some reason, thin stone does not come with this catalog. But a file called thin_parser.so is in the parent directory <ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/

So, my first decision was to create the 1.9 directory and copy the thin_parser.so file onto 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 easier

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

I'm not sure if the workaround is the best, since I don't know what other thin files are expected in the existing directory. I do not know where Thin.win is located? the plug is becoming important.

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

Yours faithfully,
Tim

+5
source

I encountered the same error when running rake db:migrate (I suspect that a thin start would give me the same error.)

I work on Amazon Linux (based on rpm, just like CentOS and Redhat). I used to install thin as root (gem install thin). Although this may not be relevant for your situation, just for completeness, I also installed eventmachine using:

 gem install eventmachine --platform=ruby 

Here is my mistake:

 % 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 a rake under strace and found that it was looking for thin_parser.so in the wrong place. I was able to fix the problem by setting this symbolic link (I did it as root since I installed thin as root). Obviously adjust the path to the installation location of your thin version:

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

Poof! This fixed it for me.

0
source

Source: https://habr.com/ru/post/1344636/


All Articles