2

http://0.0.0.0:3000/Ruby on Railsは:application.jsファイルのガット・エラー、スプロケット::ホーム#インデックス

Sprockets::FileNotFound in Home#index 

Showing /home/user1/rorblog/app/views/layouts/application.html.erb where line #6 raised: 

couldn't find file 'jquery' 
    (in /home/user1/rorblog/app/assets/javascripts/application.js:7) 

Extracted source (around line #6): 

3: <head> 
4: <title>Rorblog</title> 
5: <%= stylesheet_link_tag "application" %> 
6: <%= javascript_include_tag "application" %> 
7: <%= csrf_meta_tags %> 
8: </head> 
9: <body> 

中にFileNotFoundしかし、すべてのファイルがあるように見えます。

application.html.erb =>

<!DOCTYPE html> 
<html> 
<head> 
    <title>Rorblog</title> 
    <%= stylesheet_link_tag "application" %> 
    <%= javascript_include_tag "application" %> 
    <%= csrf_meta_tags %> 
</head> 
<body> 
<div id="container"> 

    <div id="header"> 

     <ul class="hmenu"> 
      <li> 
       <%= link_to('Home', home_index_path) %> 
      </li> 
      <% if user_signed_in? %> 
       <li> 
       <%= link_to('Logout', destroy_user_session_path, :method => :delete) %> 
       </li> 

       <li> 
       <%= link_to('Edit registration', edit_user_registration_path) %> 
       </li> 

      <% else %> 
       <li> 
       <%= link_to('Login', new_user_session_path) %> 
       </li> 
      <% end %> 
     </ul> 
     <p class="notice"><%= notice %></p> 
     <p class="alert"><%= alert %></p>  
    </div> 

    <div id="content"> 
     <div id="loadwhat"> 
      <%= yield %> 
     </div> 
    </div> 

    <div id="footer"> 
     <%= "[email protected]" %> 
    </div> 
</div> 

</body> 
</html> 

Gemfile =>

source 'http://rubygems.org' 

#gem 'rails', '3.1.1' 
gem 'rails' 

# Bundle edge Rails instead: 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 

gem 'pg' 
gem 'devise' 
#gem 'rack', '1.3.3' 
gem 'will_paginate' 

gem 'sqlite3' 


# Gems used only for assets and not required 
# in production environments by default. 
#group :assets do 
# gem 'sass-rails', '~> 3.1.4' 
# gem 'coffee-rails', '~> 3.1.1' 
# gem 'uglifier', '>= 1.0.3' 
#end 

#gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 

group :test do 
    # Pretty printed test output 
    gem 'turn', :require => false 
end 

答えて

6

コメントを解除し、あなたのgemfileでこの行:

 
#gem 'jquery-rails' 
+0

は、なぜ私はこのコメントを解除しますか? jqueryが必要な場合、アプリ/アセットに入れることはできますか? – shibly

+0

はい、できます。しかし、jquery-railsの宝石には、Rails Unobtrusive Javascript Adapter(https://github.com/rails/jquery-rails/blob/master/vendor/assets/javascripts/jquery_ujs.js)のコードも含まれています。 –

関連する問題