Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory @ dir_initialize when using include_ember_script_tags #554

Open
JHKennedy4 opened this issue Nov 1, 2017 · 2 comments

Comments

@JHKennedy4
Copy link

Which operating system and version is the project developed on?
Mac OS 10.13
Which version of ruby is the project developed on?
2.4.2
Which version of npm is the project developed on?
3.10.10
Which version of ember-cli is the project developed on?
2.16.2
What is the rails version?
5.1.4
What is the ember-cli-rails version (from Gemfile)?
0.10.0
What is the ember-cli-rails-addon version (from package.json)?
0.10.0
Is your application server multi-threaded
(such as puma and unicorn) or is it multi-process (such as thin and webrick)?

Puma
What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :glimmer_app,
    path: 'glimmer-app' # relative path to app root
  c.app :glimmer_hybrid,
    path: 'glimmer-hybrid' # relative path to app root
  c.app :glimmer_hybrid_v2,
    path: 'glimmer-hybrid-v2' # relative path to app root
end

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

<!DOCTYPE html>
<html>
<head>
  <%= csrf_meta_tags %>
  <title>Glimmer Hybrid V2</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
  <h1>Server Rendered Stuff</h1>
  <div id="app"></div>
  <base href="/hybrid-v2/">
  <%= include_ember_script_tags :glimmer_hybrid_v2 %>
</body>
</html>

How are the EmberCLI-related routes defined?

Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
  mount_ember_app :glimmer_app, to: "/glimmer" # this works fine

  mount_ember_app :glimmer_hybrid_v2, to: "/hybrid-v2", controller: "hybrid_v2", action: "index"
  mount_ember_assets :glimmer_hybrid_v2, to: "/" # not sure what combo I should be using here
end

How is the application deployed?
Running locally.

We are attempting to set up a proof of concept for using Glimmer to add "islands of richness" to a primarily server rendered application. Our goal is to be able to serve the "index" page from rails, and add the ember assets using <%= include_ember_script_tags :glimmer_hybrid_v2 %> (assuming that is in-fact the right tool for this job).

We are currently running into trouble with that tag. We are seeing the following error:

No such file or directory @ dir_initialize - /Users/jhk/Development/invoices-public/tmp/ember-cli/apps/glimmer_hybrid_v2/assets

The assets appear to build correctly, but not in the assets directory. They are on that same route minus the /assets portion.
screen shot 2017-11-01 at 11 09 23 am

I imagine we might have messed something up with the way our routes are configured, but I think at this point we've tried nearly every permutation described in the README. Is there an issue with the way include_ember_script_tags routes to the mounted app or assets?

@JHKennedy4 JHKennedy4 changed the title No such file or directory @ dir_initialize when using include_ember_script_tags No such file or directory @ dir_initialize when using include_ember_script_tags Nov 1, 2017
@ryanjm
Copy link

ryanjm commented Dec 5, 2017

I'm running into a similar thing: Permission denied @ dir_s_mkdir - /app

config/initializers/ember.rb:

EmberCli.configure do |c|
  c.app :frontend
end

App is located in frontend in the root (though eventually I want to move it to app/assets).

In my routes.rb:

    mount_ember_assets :frontend, to: "/"

In my view:

  <%= include_ember_script_tags :frontend %>

Seems very straight forward, but I'm not sure what is going wrong.

I don't even see where include_ember_script_tags is in the project anymore. I see it in an old commit here but that file doesn't seem to exist anymore. I don't even see javascript_include_tag in the project anymore. Was this functionality removed? If so, any suggestions for making this work?

I have a similar issue as @JHKennedy4. We have an app already built and we are wanting to add Ember slowly, first to just parts of pages, and then to expand the usage over time. For now we just need to get those assets into the rails page.

@ryanjm
Copy link

ryanjm commented Dec 5, 2017

Update
I had to compile the app. Nothing was in my tmp/ember-cli/frontend folder.

rake ember:compile

Then I changed my routes to:

    mount_ember_assets :frontend, to: "frontend"

And added the following to my erb (instead of include_ember_script_tags):

  <%= javascript_include_tag "/frontend/assets/vendor.js", "/frontend/assets/frontend.js" %>

And it is working now (I personally also needed to follow the instructions here to load the app onto a particular element instead of the entire page, but that is pretty stright forward once you have the JS loading on the page).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants