ember-rails: Compiler said: ReferenceError: Can't find variable: window

ember-rails: Compiler said: ReferenceError: Can't find variable: window

所以我开始使用 ember-rails,但我遇到了一个最令人烦恼的问题。

Ruby2.1.0,Rails4.0,Ember1.10.0,Ember-数据 1.0.0-beta14.1,Ember -rails 0.16.1

我已经查阅了文档,google,还有这个 wonderful example app,但我运气不太好。我确定我做错了什么,但我不知道那可能是什么。

错误:

Started GET "/" for 127.0.0.1 at 2015-02-12 20:30:14 -0500
  ActiveRecord::SchemaMigration Load (0.2ms)  SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by StuffController#index as HTML
  Rendered stuff/index.html.erb within layouts/application (0.9ms)
Completed 500 Internal Server Error in 329ms

ActionView::Template::Error (Pre compilation failed for: {{render "navbar"}}
<div class="container-fluid">
    {{outlet}}
</div>

Compiler said: ReferenceError: Can't find variable: window
  (in /Users/cboebel/Documents/Development/Ruby/VQ/app/assets/javascripts/templates/application.handlebars)):
    3: <head>
    4:   <title>VQ</title>
    5:   <%= stylesheet_link_tag    'application', media: "all" %>
    6:   <%= javascript_include_tag 'application' %>
    7:   <%= csrf_meta_tags %>
    8:   <%= favicon_link_tag '/assets/VQ-logo-transparent-RGB-72dpi.png' %>
    9: </head>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___840981524341116597_2188195620'


  Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
  Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (14.8ms)
  Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (24.7ms)

Application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>VQ</title>
  <%= stylesheet_link_tag    'application', media: "all" %>
  <%= javascript_include_tag 'application' %>
  <%= csrf_meta_tags %>
  <%= favicon_link_tag '/assets/VQ-logo-transparent-RGB-72dpi.png' %>
</head>
<body style="padding-top: 60px;">
  <%= yield %>
</body>
</html>

index.html.erb为空

application.js

//= require jquery
//= require jquery-ui
//= require best_in_place
//= require jquery_ujs
//= require bootstrap
//= require handlebars
//= require ember
//= require ember-data
//= require_self
//= require app
App = Ember.Application.create({
    LOG_ACTIVE_GENERATION: true,
    LOG_VIEW_LOOKUPS: true,
    LOG_TRANSITIONS: true,
    LOG_TRANSITIONS_INTERNAL: true,
    LOG_BINDINGS: true,
    LOG_RESOLVER: true,
    DEBUG: true
});

app.js

//= require store
//= require_tree ./adapters
//= require_tree ./mixins
//= require_tree ./models
//= require_tree ./controllers
//= require_tree ./views
//= require_tree ./helpers
//= require_tree ./components
//= require_tree ./templates
//= require_tree ./routes
//= require router
//= require_self

application.handlebars

{{render "navbar"}}
<div class="container-fluid">
    {{outlet}}
</div>

编辑:

我应该指出我有

config.ember.variant = :development

在development.rb

编辑:

我 "fixed" 通过 gem 卸载 ember* gem 和 ember-[=64= 的所有依赖项] 然后重新安装它们。仍然不确定发生了什么。

其他人的简短版本升级到 ember-rails 0.16.2(或更高版本)并从 v3 降级车把到 v2.

重新安装使您升级到 this checkin ember-rails 0.16.1 正在添加导致 'cant find variable: window' 问题的车把 v3。 ember-rails 0.16.2 已修复此问题。