前提・実現したいこと
railsでSNSアプリを作成しています
ですが突然次のようなエラーに襲われました
もうかなり格闘しているのでご教授おねがいします!
発生している問題・エラーメッセージ
stylesheet_link_tagにapplication.scssを指定して読みこんでいました。
ですが別のデバックでどこかをいじってしまったのかとつぜん次のようなエラーが出てくるようになってしまいました。
またこのエラーが出る際ページのロードにものすごく時間がかかります。その上パソコンがものすごく熱くなります
cannot load such file -- coffee_script
該当のソースコード
ruby
1<!DOCTYPE html> 2<html> 3 <head> 4 <title>NTwitter</title> 5 <%= csrf_meta_tags %> 6 <%= csp_meta_tag %> 7 8 <%=stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'%> 9 <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 10 </head> 11 12 <body> 13 <%= yield %> 14 </body> 15</html>
試したこと
最初はapplication.scssを読み込めていないのだと思いapplication.scssに確認のためわざとエラーを起こす文をかいてみると上記のように熱くならずロードボタンを押してからすぐにページが表示されました。
このことからおそらくapplication.scssを読みこんだ後に何らかの無限ループ的なエラーが起きているのだと推測しました
エラー分に書いてあるようにcofeescriptのエラーかと思い少し調べてみると自分で以前作った正常に動くアプリのgemfileには'coffee-rails'というジェムが入っていましたがエラーの起こるアプリには書いていませんでした。
これだ!と思いgemfileに記述してbundle installしたのですが解決しませんでした。
どうかお助けください
補足情報(FW/ツールのバージョンなど)
gemfile
1ruby '2.5.0' 2 3 4# これより追加部分 5 6# Inclua nas versões quando rails >= 5.1 7 8gem 'jquery-turbolinks' 9 10gem 'jquery-rails' 11 12# Sempre inclua 13gem 'materialize-sass' 14gem 'material_icons' 15 16gem 'hirb' 17gem 'hirb-unicode' 18 19group :development, :test do 20 gem 'pry-rails' # irbの代わりにpryにする 21end 22 23 24# 追加部分終わり 25 26 27# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 28gem 'rails', '~> 6.0.0' 29# Use sqlite3 as the database for Active Record 30gem 'sqlite3', '~> 1.4' 31# Use Puma as the app server 32gem 'puma', '~> 3.11' 33# Use SCSS for stylesheets 34gem 'sass-rails' 35# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 36gem 'webpacker', '~> 4.0' 37# Use CoffeeScript for .coffee assets and views 38gem 'coffee-rails', '~> 4.2' 39# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 40gem 'turbolinks', '~> 5' 41# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 42gem 'jbuilder', '~> 2.7' 43# Use Redis adapter to run Action Cable in production 44# gem 'redis', '~> 4.0' 45# Use Active Model has_secure_password 46# gem 'bcrypt', '~> 3.1.7' 47 48# Use Active Storage variant 49# gem 'image_processing', '~> 1.2' 50 51# Reduces boot times through caching; required in config/boot.rb 52gem 'bootsnap', '>= 1.4.2', require: false 53 54group :development, :test do 55 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 56 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 57end 58 59group :development do 60 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 61 gem 'web-console', '>= 3.3.0' 62 gem 'listen', '>= 3.0.5', '< 3.2' 63 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 64 gem 'spring' 65 gem 'spring-watcher-listen', '~> 2.0.0' 66end 67 68group :test do 69 # Adds support for Capybara system testing and selenium driver 70 gem 'capybara', '>= 2.15' 71 gem 'selenium-webdriver' 72 # Easy installation and use of web drivers to run system tests with browsers 73 gem 'webdrivers' 74end 75 76# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 77gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/11/30 12:44
2019/12/02 22:01