Rails5でjqueryを使用したい
Railsでweb開発の勉強をしている中でjqueryの読み込みで躓きました。
gem 'jquery-rails', '~> 4.3', '>= 4.3.1'
bundle install
をしましたがページを見てみると、//= require jquery
の部分でエラーが表示されてしまいます。
発生している問題・エラーメッセージ
Sprockets::FileNotFound in Home#top couldn't find file 'jquery' with type 'application/javascript'
該当のソースコード
Gemfile source 'https://rubygems.org' gem 'rails', '~> 5.1.4' gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'puma', '~> 3.7' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.2' gem 'turbolinks', '~> 5' gem 'jbuilder', '~> 2.5' gem 'jquery-rails', '~> 4.3', '>= 4.3.1' group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'capybara', '~> 2.13' gem 'selenium-webdriver' end group :development do gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
javascript
1// This is a manifest file that'll be compiled into application.js, which will include all the files 2// listed below. 3// 4// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5// vendor/assets/javascripts directory can be referenced here using a relative path. 6// 7// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8// compiled file. JavaScript code in this file should be added after the last require_* statement. 9// 10// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11// about supported directives. 12// 13//= require jquery 14//= require jquery_ujs 15//= require rails-ujs 16//= require turbolinks 17//= require_tree .
試したこと
gem jquery-ujs
などbundle install
しましたが無意味でした。
補足情報(FW/ツールのバージョンなど)
Rails 5.1.4
Ruby 2.4.1

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。