Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load such file "script/../config/boot' #782

Closed
HuckyDucky opened this issue Sep 17, 2015 · 4 comments
Closed

Cannot load such file "script/../config/boot' #782

HuckyDucky opened this issue Sep 17, 2015 · 4 comments

Comments

@HuckyDucky
Copy link

I just moved from rvm`` torbenv```. I needed to install a newer version of ruby and I wanted to insulate the ruby that was running for a legacy Rails 2.3.15 application I have on this server.

I have had that legacy app working with Bundler for 2 years.

After reinstalling ruby, my Rails application refuses to load. I ended up installing a newer version of Ruby (2.1.5) since it was a nightmare trying to get any version of 1.8.7 (openssl issues) or 1.9.3 installed via rbenv. I don't think this is a shortcoming of rbenv, just configuration changes over the years.

Anyway, this 2.1.5 ruby version absolutely refuses to load the config/boot.rb file. Just flat out says it can't load it. Very unhelpful.

The require line that is failing in script/console:

require File.dirname(__FILE__) + '/../config/boot'
/home/myapp/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- script/../config/boot (LoadError)

At the top of this script/console file is:

#!/usr/bin/env ruby

Could that somehow be causing a problem?

@mislav
Copy link
Member

mislav commented Sep 18, 2015

In newer versions of Ruby, the current directory is no longer in $LOAD_PATH by default. That means that using require to load files relative to the current directory (such as script/../config/boot which expands to simply config/boot) won't work.

Your alternatives are:

  1. edit $LOAD_PATH to include the current directory (by e.g. $LOAD_PATH << ".");
  2. use require_relative "../config/boot" in script/console; or
  3. just ditch script/console and use rails console which is the new way of starting the console in newer Rails versions.

@hsbt
Copy link
Member

hsbt commented Sep 18, 2015

It's not rbenv problem. Rails 2.3 (already EOL) do not support Ruby 1.9 later.

@mislav
Copy link
Member

mislav commented Sep 18, 2015

@hsbt Ah yes, thanks for reminding me: rails console is only a thing since Rails 3.

@HuckyDucky It shouldn't be impossible to install an older version of Ruby on your computer.

@HuckyDucky
Copy link
Author

It's probably not impossible, but it's excruciatingly painful on RedHat. Lots of known issues with compiling against RH's OpenSSL with Ruby 1.8.7. I just have to last a little longer with this old app during the rewrite.

It's silly, but I was able to run this using:

./script/console

instead of just calling:

/script/console

Works like a champ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants