tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

EmberCLI failed to generate an `index.html` file #467

Closed Chrisgo-75 closed 8 years ago

Chrisgo-75 commented 8 years ago

Following the README, the Rails/Ember application works nicely on my Ubuntu 14.04 LTS VirtualMachine. When I deploy to our staging server (Ubuntu 14.04 LTS, Apache 2.4.7, Phusion Passenger) I get an error in the Rails log that says

I, [2016-06-29T08:47:59.697005 #15744]  INFO -- : Started GET "/emb_apps/" for <ip> at 2016-06-29 08:47:59 -0500
I, [2016-06-29T08:47:59.792540 #15744]  INFO -- : Processing by EmberCli::EmberController#index as HTML
I, [2016-06-29T08:47:59.792684 #15744]  INFO -- :   Parameters: {"ember_app"=>:frontend}
I, [2016-06-29T08:47:59.817686 #15744]  INFO -- :   Rendered ember_cli/ember/index.html.erb (17.9ms)
I, [2016-06-29T08:47:59.818193 #15744]  INFO -- : Completed 500 Internal Server Error in 25ms (ActiveRecord: 0.0ms)
F, [2016-06-29T08:47:59.821062 #15744] FATAL -- :
ActionView::Template::Error (          EmberCLI failed to generate an `index.html` file.
):
    1: <%= render_ember_app ember_app do |head| %>
    2:   <% head.append do %>
    3:     <style>
    4:       * { color: red; }
  app/views/ember_cli/ember/index.html.erb:1:in `_app_views_ember_cli_ember_index_html_erb___1898049838548125681_14249180'

I run "RAILS_ENV=staging bundle exec rake assets:precompile" before I deploy and am using Capistrano in deploying.

Any ideas on why I am getting the error? Why is the Rails/Ember working in my VM but not on the staging server? I can post code if that would be helpful ... which files? Thank you, Chris

Which operating system and version is the project developed on? Ubuntu 14.04 LTS, Apache 2.4.7, Phusion Passenger

Which version of ruby is the project developed on? Ruby 2.3.0

Which version of npm is the project developed on? node v5.10.1 (npm v3.9.0)

Which version of ember-cli is the project developed on? "ember-cli": "2.4.3"

What is the rails version? Rails 4.2.6

What is the ember-cli-rails version (from Gemfile)? ember-cli-rails (0.7.4)

What is the ember-cli-rails-addon version (from package.json)? "ember-cli-rails-addon": "~> 0.7.0",

Is your application server multi-threaded (such as puma and unicorn) or is it multi-process (such as thin and webrick)? Phusion Passenger & Apache

What are the contents of config/initializers/ember.rb? c.app :frontend # assumes your Ember app exists in Rails.root.join("frontend") c.app :cda

What are the contents of the Rails' view that renders the Ember application?

# File: /app/views/ember_cli/ember/index.html.erb
<%= render_ember_app ember_app do |head| %>
  <% head.append do %>
    <style>
      * { color: red; }
    </style>
    <%= csrf_meta_tags %>
  <% end %>
<% end %>

How are the EmberCLI-related routes defined?

# /config/routes.rb
mount_ember_app :frontend, to: '/'

# /frontend/config/environment.js
/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'frontend',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.baseURL = '/';
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'staging') {

  }

  if (environment === 'production') {

  }

  return ENV;
};

How is the application deployed? Capistrano

dcyriller commented 8 years ago

I ran into this error after upgrading emberjs to ~2.6.0 in my frontend/bower.json file. (App deployed to heroku) Reverting it to ~2.5.0 solved the issue. This is not an answer but maybe it can help.

Chrisgo-75 commented 8 years ago

@dcyriller thanks for your response. That is an option that I hadn't considered yet ... to change the version of emberjs and re-try. Do you know if I need nodejs running on the server for EmberCLI to work? I assumed the answer would be no because Ember files are static files after the build process.

Chrisgo-75 commented 8 years ago

@dcyriller I updated Ember to ~2.5.0 and I get the same error "EmberCLI failed to generate an index.html file" on our staging server. Wanted to say thank you for your comment.

Chrisgo-75 commented 8 years ago

Wasn't able to resolve the issue ... closing issue.

sebbean commented 7 years ago

? why would you close if you couldnt resolve?

sebbean commented 7 years ago

having the same issue myself

Chrisgo-75 commented 7 years ago

@sebbean Why did I close? b/c I wasn't getting any help from the authors of the gem. b/c I didn't want to leave the ticket open when I don't have huge amounts of time to invest in Ember.

I never did find out why my setup was failing to generate 'index.html' file. Google search found hits but nothing panned out. I ended up coding up a Rails 3 application and Ember application separately and then adding the Ember app within Rails.

I wish you luck!

sebbean commented 7 years ago

leaving it open seems like a better idea if it's still an issue i'd think.. does it hurt?

my issue was that assets:precompile wasnt running pre-deploy