简体   繁体   中英

LoadError: cannot load such file — etc

I am seeing this error, after upgrading to ruby 2.7.2 using ruby-build and rbenv on Mac OS BigSur.

Rails 6.0.3.5

≻ bundle exec rspec spec/acceptance/roles_spec.rb    
An error occurred while loading ./spec/acceptance/roles_spec.rb. - Did you mean?
                    rspec ./spec/acceptance/users_spec.rb


Failure/Error: require File.expand_path('../config/environment', __dir__)

LoadError:
  cannot load such file -- etc
# ./config/application.rb:5:in `<top (required)>'
# ./config/environment.rb:2:in `require_relative'
# ./config/environment.rb:2:in `<top (required)>'
# ./spec/rails_helper.rb:7:in `require'
# ./spec/rails_helper.rb:7:in `<top (required)>'
# ./spec/acceptance_helper.rb:1:in `require'
# ./spec/acceptance_helper.rb:1:in `<top (required)>'
# ./spec/acceptance/roles_spec.rb:1:in `require'
# ./spec/acceptance/roles_spec.rb:1:in `<top (required)>'
No examples found.

Application.rb:5 - require "rails"

I have tried to create a completely new Rails project with same rails and ruby version, which didn't have the same problem running rake rspec.

This issue got solved after doing the following:

  • Delete bootsnap cache:

    rm -rf tmp/cache/bootsnap*

This might have solved the issue, but I did also:

  • Use ruby 2.7.3
  • bundle update bootsnap simplecov Installing bootsnap 1.7.5 (was 1.7.2)

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