Rails 生成 rspec:install - 没有要加载的文件 --sprockets/railtie (LoadError)

2024-04-05

我是 RoR 初学者,我开始通过 RoR 教程学习它。 其实我就在这一章(http://ruby.railstutorial.org/chapters/static-pages#top http://ruby.railstutorial.org/chapters/static-pages#top)并尝试安装 rspec。但每次当我尝试使用“rails g rspec:install”时,我都会收到此错误消息:

C:\Sites\rails\rails_projects\sample_appp>rails g rspec:install
C:/Sites/rails/rails_projects/sample_appp/config/application.rb:8:in `require':
no such file to load -- sprockets/railtie (LoadError)
        from C:/Sites/rails/rails_projects/sample_appp/config/application.rb:8:i
n `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `require'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

有人有想法可以帮助我吗?我已经尝试在 application.rb 中注释掉它或在 gemfile 中明确提及它。但我仍然收到此错误消息。

如果有人能帮助我,那就太好了。顺便提一句。我的操作系统是 Windows XP,我使用的是 Ruby 版本 1.9.2.p290 和 Rails 版本 3.1.0.rc6。


这就是我所做的:

网站上的 gemfile 显然有点错误,我正在使用这个:

source 'http://rubygems.org'

gem "rails", "~> 3.1.0"
gem 'sqlite3', '1.3.3'

group :development do
gem 'rspec-rails', '2.6.1'
end

group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
end

在你的终端类型中

$ bundle update
$ bundle install

然后重试该命令

rails generate rspec:install

祝你好运! :)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Rails 生成 rspec:install - 没有要加载的文件 --sprockets/railtie (LoadError) 的相关文章

随机推荐