如何修复模板错误“ CoffeeScript未定义”

ay

我正在尝试显示我的项目的视图。但是我得到这个错误:

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]
霍萨姆·卡米斯(Hossam Khamis)

最近更新的coffe-script-source gem 1.12.1中存在问题。问题是此版本中的源文件为空。已经存在一个未解决的问题,应尽快解决。

现在您可以将其添加到您的GemFile中

gem 'coffee-script-source', '= 1.11.1'

并运行bundle update coffee-script-source直到修复。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Hubot中的Coffeescript错误“未定义不是函数”

如何修复截断的错误DOUBLE值:“未定义”错误

如何修复 Python 中的“未定义类名”错误?

如何修复JSlint报告的“未定义foo”错误?

如何修复R中未定义的列选择错误?

如何修复R中的“未定义列选择”错误?

如何修复PyDev“导入时未定义变量”错误?

如何为Netlify网站修复“ sha”未定义错误?

如何修复销毁函数中的“未定义方法”错误

如何修复NetLogo 6.0.4中的“名称未定义?”错误

如何修复“无法读取未定义的属性”错误

如何修复VueJS中的“属性或方法未定义”错误

如何修复 Django 中的“名称‘csrf’未定义”错误

方法存在时如何修复“未定义的方法错误”?

如何修复“全局名称 --- 未定义错误”

PHP错误未定义变量注意如何修复?

如何修复v8错误的未定义引用?

如何修复错误标识符“PlayerViewPointLocation”未定义

如何在javascript中修复“错误:未定义”?

如何修复python中的“名称'self'未定义”错误?

如何修复此错误“未定义变量:产品(0)”

如何修复 Python 中的“未定义名称”错误消息?

如何修复错误“this.accountService 未定义”

如何修复meteor.js中的“模板助手中的异常:ReferenceError:Todos未定义”错误

如何修复“未定义的ReadFile”

如何修复未定义的数组

如何修复 _this.video 未定义

如何修复“对象可能未定义”?

如何修复ReferenceError:未定义google