Reputation: 11
I'm getting an odd error, where no rails commands of any kind are executing. Whenever I enter a rails command I get the following:
Ignoring racc-1.5.2 because its extensions are not built. Try: gem pristine racc --version 1.5.2
(this is repeated about 100 times before the following):
bin/rails:2:in `load': /Users/robertmorris/Desktop/All Projects/Code School/my9s/bin/spring:11: syntax error, unexpected keyword_rescue, expecting keyword_end (SyntaxError) rescue Gem::LoadError ^ /Users/robertmorris/Desktop/All Projects/Code School/my9s/bin/spring:14: syntax error, unexpected keyword_end, expecting end-of-input from bin/rails:2:in `<main>'
My bin/spring file:
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
gem "bundler"
require "bundler"
# Load Spring without loading other gems in the Gemfile, for speed.
Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem "spring", spring.version
require "spring/binstub"
rescue Gem::LoadError
# Ignore when Spring is not installed.
end
end
Thanks!
Upvotes: 0
Views: 164
Reputation: 16435
You are using an old (unsupported) version of ruby.
You should upgrade it using any available local version manager like rvm
, rbenv
or asdf
, to at least 2.5, or better 2.7 or 3.
On ruby 2.4 and previous, you could only rescue inside either a method:
def foo
# do something
rescue
# do something else
end
or an explicit begin
/end
block:
begin
# do something
rescue
# do something else
end
Since ruby 2.5 was released, all do
/end
blocks can have rescue
clauses:
foo.bar.baz.tap do
# do something
rescue
# do something else
end
while before that you had to
foo.bar.baz.tap do
begin
# do something
rescue
# do something else
end
end
Upvotes: 1