Spork cannot load such a file?

I have a problem with gems. Each time I run the spork command, I get this long error:

evan@TheBeast-Computer :~/rails_projects/sample_app$ spork Using RSpec Preloading Rails environment Loading Spork.prefork block... cannot load such file -- /home/evan/rails_projects/sample_app/spec_helper (LoadError) /home/evan/rails_projects/sample_app/spec/spec_helper.rb:57:in `require_relative' /home/evan/rails_projects/sample_app/spec/spec_helper.rb:57:in `block in <top (required)>' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:24:in `prefork' /home/evan/rails_projects/sample_app/spec/spec_helper.rb:6:in `<top (required)>' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `block in load' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:138:in `block (2 levels) in preload' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/app_framework/rails.rb:8:in `preload' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:134:in `block in preload' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:62:in `exec_prefork' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:120:in `preload' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:25:in `preload' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:74:in `run' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run' /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/bin/spork:10:in `<top (required)>' /home/evan/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `load' /home/evan/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `<main>' 

Here is my gemfile:

 source 'https://rubygems.org' gem 'rails', '3.2.5' gem 'sqlite3' group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' group :development, :test do gem 'rspec-rails', ">= 2.0.1" end group :test do gem 'rspec-rails', '>= 2.0.1' gem 'spork', '>= 0.8.4' end 

I cannot understand what to do or how to describe my situation. But the result that I see in the Ruby on Rails 3 tutorial shows:

 $ spork Using RSpec Loading Spork.prefork block... Spork is ready and listening on 8989! 
+4
source share
6 answers

You have the same problem after updating the system. This happened due to the lack of read privileges in the file.

A simple chmod + r worked for me:

 sudo chmod +r /home/evan/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/bin/spork 

EDIT

I again had a problem upgrading to Rails 3.2.9 and Ruby 1.9.3-p327. Unfortunately, this time it was not based on access rights, but on the gem that developed between the two updates (it should be completely transparent). Therefore, if you get this problem, you should also check which file is missing, if you do not have privilege access rights and correctly update the corresponding stones.

+10
source

In appearance, you have the spec_helper.rb file in the "spec" folder that spork is trying to load, and inside this file on line 57 you have a block inside which you have the require_relative "../spec_helper" that points to 'spec_helper.rb' in the project root folder, and ruby ​​'cannot load such a file' because it is missing.

+1
source

Had the same problem but was able to go into spec_help.rb and just save it. As soon as I did this, it began to work.

+1
source

I am using Rails 3.2.12 and ruby-1.9.3-p392. In my case, adding require 'spork' to my Gemfile and running bundle install did the trick.

+1
source

In fact, I ran into the same problem. In my environment / test.rb file, I set config.cache_classes to true.

In fact, for Confork to work correctly, config.cache_classes must be set to false.

0
source

I had the same problem. I had

 require 'spec_helper' 

inside the spec_helper.rb file ... allows you to query the spec_helper.rb file in a recursive way. Just delete this line and now everything is working fine.

0
source

All Articles