简体   繁体   English

rails生成rspec:install - 没有这样的文件加载--sprockets / railtie(LoadError)

[英]rails generate rspec:install - no such file to load --sprockets/railtie (LoadError)

I'm a RoR-Beginner and I started learning it with the RoR-Tutorial. 我是RoR-Beginner,我开始用RoR-Tutorial学习它。 Actually I'm at this chapter ( http://ruby.railstutorial.org/chapters/static-pages#top ) and try to install rspec. 其实我正在本章( http://ruby.railstutorial.org/chapters/static-pages#top )并尝试安装rspec。 But everytime when I try to use "rails g rspec:install" I get this error message: 但每当我尝试使用“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>'

Has anybody an idea to help me? 有人有意帮助我吗? I already tried to comment it out in the application.rb or to explicitly mention it in the gemfile. 我已经尝试在application.rb中对它进行注释,或者在gemfile中明确提及它。 But I still get this error message. 但我仍然收到此错误消息。

Would be great if anyone could help me. 如果有人能帮助我会很棒。 Btw. 顺便说一句。 my OS is Windows XP and I'm using Ruby version 1.9.2.p290 and Rails version 3.1.0.rc6. 我的操作系统是Windows XP,我使用的是Ruby版本1.9.2.p290和Rails版本3.1.0.rc6。

Here's what I did: 这是我做的:

the gemfile on the site is apparently slightly wrong, i'm using this: 网站上的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

in your terminal type 在您的终端类型

$ bundle update
$ bundle install

then try again the command 然后再试一次命令

rails generate rspec:install

Good luck! 祝好运! :) :)

How did you install rspec? 你是怎么安装rspec的? Did you do a "gem install" or did you put it in your Gemfile? 你做过“宝石安装”还是把它放在你的Gemfile中? If it's only in your Gemfile, try putting "bundle exec" in front of your command, like this: 如果它只在您的Gemfile中,请尝试在命令前放置“bundle exec”,如下所示:

bundle exec rails g rspec:install

I know I have to use bundle exec when I run the specs, so you may need it for the init script too (I can't remember from when I did it, but I have the exact same ruby/rails versions) 我知道在运行规范时我必须使用bundle exec,所以你也可能需要它用于init脚本(我不记得从什么时候开始,但我有完全相同的ruby / rails版本)

Seems like you've created your project with a later version (rails 3.1) of rails gem. 好像你用rails gem的更高版本(rails 3.1)创建了你的项目。 Make sure you're using a gemset which only has rails 3.0.9 gems and then do rails new to create your project. 确保你使用的gemset只有rails 3.0.9 gems,然后使用rails new来创建你的项目。 This will make sure that the sprockets/railtie line would not occur in your application.rb 这将确保您的application.rb中不会出现链轮/铁路线

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载Rails Server(3.0.11,ruby 1.9.2),没有要加载的此类文件-链轮/ railtie(LoadError) - Trouble loading Rails Server (3.0.11, ruby 1.9.2), no such file to load — sprockets/railtie (LoadError) Rails Rspec `require': 无法加载此类文件 -- rails_helper (LoadError) - Rails Rspec `require': cannot load such file -- rails_helper (LoadError) LoadError: cannot load such file — rails_helper (Rails 6 and Rspec) - LoadError: cannot load such file — rails_helper (Rails 6 and Rspec) Rails rspec LoadError:无法加载此类文件— main_helper - Rails rspec LoadError: cannot load such file — main_helper Rails rspec问题(无法加载此类文件--b(LoadError)) - Rails rspec issues (cannot load such file --b (LoadError)) 没有要加载的此类文件— rspec / autorun(LoadError) - no such file to load — rspec/autorun (LoadError) `require':无法加载这样的文件 - capybara / rspec(LoadError) - `require': cannot load such file — capybara/rspec (LoadError) 没有此类文件可加载— ap(LoadError) - rails no such file to load — ap (LoadError) Rails“没有这样的文件加载 - ruby​​gems(LoadError)” - Rails “no such file to load — rubygems (LoadError)” 如何调试Rails的“无法加载这样的文件-sprokets / railtie”消息 - How to debug Rails' “cannot load such a file — sprokets/railtie” message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM