我有以下rails配置:
Windows 7 Rails 4.1.1 Ruby 2.0.0p481 Gem: coffee-rails 4.0.1 Gem: coffee-script 2.3.0 Gem: coffee-script-source 1.9.1
我有一个工作正常,但现在没有.我不记得改变什么(git diff没有透露任何东西).我得到的错误是:
TypeError: Object doesn't support this property or method (in c:/Users/mbratc01/Documents/Rails/manpower/app/assets/javascripts/welcome.js.coffee) Extracted source (around line #9): 7 <%= stylesheet_link_tag 'application',media: 'all','data-turbolinks-track' => false %> 8 <%= javascript_include_tag 'jquery-1.11.1','data-turbolinks-track' => false %> 9 <%= javascript_include_tag 'application','data-turbolinks-track' => false %> 10 <%= csrf_meta_tags %> 11 </head>
我真的没有Coffeescript项目了. welcome.js.coffee的内容是:
# Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/
我发现,如果我只是将此文件移动到另一个不可访问的位置,应用程序运行正常.此外,在app / assets / javascript文件夹中只放置一个空的.coffee文件会产生相同的错误.
我在StackOverflow上看到了一些看起来非常相似的帖子,但在阅读完它们之后,我找不到问题的根本原因,也无法解决它而不只是摆脱.coffee文件.我怀疑这里的CoffeeScript功能设置有些不太正确,但不确定是什么原因似乎安装了正确的宝石.
有人建议可能导致此错误的原因是什么?
解决方法
根据
this,CoffeeScript与Windows不兼容.您可能希望尝试降级CoffeeScript版本或将其从Gemfile中完全删除.
然后只需将.coffee文件重命名为普通的.js并在您的Rails应用程序中摇滚常规javascript.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。