Railsアプリをherokuにデプロイしようとしていますが、「Sprockets :: FileNotFound:タイプ 'application/javascript'のファイル 'jquery'が見つかりませんでした。 "。 エラーのスクリーンショットも添付しました
これは私のgemfileです:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle Edge Rails instead: gem 'Rails', github: 'Rails/rails'
gem 'Rails', '~> 5.1.2'
gem 'jquery-Rails'
gem 'jquery-ui-Rails'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-Rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/Rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :Ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-Rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/Rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-Rails', group: :development
gem 'bootstrap', '~> 4.0.0.alpha6'
#Tooltips and popovers depend on tether for positioning
source 'https://Rails-assets.org' do
gem 'Rails-assets-tether', '>= 1.3.3'
end
gem 'devise'
gem 'simple_form'
gem 'carrierwave', '~> 1.0'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and Selenium driver
gem 'capybara', '~> 2.13'
gem 'Selenium-webdriver'
gem 'pry-Rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/Rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
ぼくの application.js
は次のようになります
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require tether
//= require bootstrap-sprockets
//= require Rails-ujs
//= require turbolinks
//= require_tree
と私 application.scss
は次のようになります。
*= require jquery-ui
*= require_tree .
*= require_self
*/
@import "bootstrap";
アプリケーションはローカルで正常に動作しますが、Herokuにプッシュできないようです。私はすでに試しましたrake assets:precompile
およびherokuにプッシュする前に変更をコミットしますが、まだ運がありません。
宝石を削除jquery-Rails, jquery-ui-Rails
、Rails 5.1使用Rails-ujs
デフォルトではjquery
を使用しません。 jqueryをインストールするために糸を使用してください-yarn add jquery
。 糸