简体   繁体   中英

script/server custom_require.rb:36:in `require': cannot load such file — test/unit/error (LoadError)

I have an app build on 1.8.7 and I'm trying to start it on a system with 1.9.3

When I run script/server, I'm getting:

/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- test/unit/error (LoadError)
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

My server script looks like this:

#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server

What am I missing?

Thanks Thomas

You don't add the origin path of your test. Add in your script to improve the LOAD_PATH

#!/usr/bin/env ruby
$: << File.dirname(__FILE__) + '../..'
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server

In my case, this error was due to I was trying to run a Rails 2.1.1 application with Ruby 2.0.0. I solved it by changing to Ruby 1.8.6, which was the one supported by Rails 2.1.1.

If you want to upgrade your Ruby version, you'll probably need to upgrade your Rails application as well. (Check this post for info about Ruby-Rails compatibility.)

I solved by removing the ../ path in the file /var/www/redmine-2.6.0/config/boot.rb

# Before
require File.expand_path('../../config/boot', __FILE__)
# After
require File.expand_path('../config/boot', __FILE__)

I hope it helps.

Marcos Rogerio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM