我想讓我的項目的視圖顯示出來。但我得到這個錯誤:如何解決模板錯誤「CoffeeScript未定義」
ActionView::Template::Error (ReferenceError: CoffeeScript is not defined):
4: <title>Myapp</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9: </head>
10:
當我刪除7-8行,然後它工作,但我就沒有CSS或JavaScript。
我一個星期前沒有收到這個錯誤。我不確定原因是什麼。我嘗試過切換Rails版本。我試着卸載Postgres並重新設置它,但它似乎不是問題。 我有Rails 5.0.0.1,和「Ruby 2.3.3p222(2016-11-21修訂版56859)[x86_64-darwin16]」。另外我正在使用Mac OS Sierra。
我可以將「應用程序」更改爲「默認」,它可以工作,但我不明白爲什麼它在一週前運行,而不是現在。
我也有我的看法和控制器設置,這就是爲什麼它工作時,我刪除線7-8。
這是我的寶石文件:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# 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]
Postgres與它無關,它是一個作爲完全獨立應用程序運行的數據庫管理器。 –