gpt4 book ai didi

rspec-rails - Spork 无法加载此类文件?

转载 作者:行者123 更新时间:2023-12-04 02:59:51 27 4
gpt4 key购买 nike

我有一个 spork gem 问题。每次运行 spork 命令时,都会出现这个长错误:

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>'

这是我的 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

我不知道该怎么做或如何描述我的情况。但是我在 Ruby on Rails 3 教程书中看到的结果显示:
$ spork
Using RSpec
Loading Spork.prefork block...
Spork is ready and listening on 8989!

最佳答案

刚刚系统更新后遇到同样的问题。这是由于缺少对文件的读取权限。

一个简单的 chmod +r 对我有用:

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

编辑

更新到 Rails 3.2.9 和 Ruby 1.9.3-p327 时,我又遇到了这个问题。不幸的是,这一次不是来自访问权限问题,而是来自两次更新之间演变的 gem (应该是完全透明的)。因此,如果您遇到此问题,如果您没有访问权限权限问题,您还应该检查缺少哪个文件并正确升级相应的 gem。

关于rspec-rails - Spork 无法加载此类文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10989237/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com