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

ember install error: Errno::ENOENT: No such file or directory - chdir #428

Closed LingboTang closed 8 years ago

LingboTang commented 8 years ago

I got this error when I run rake ember:install followed by the tutorial. The following code is how I set my ember.rb:

EmberCli.configure do |c|
  c.app :itemtracking
  c.app :frontend,
    path: "~/item_tracking/client/dist"
end

And how I set the routes.rb is the same as the tutorial. I'm sure the path is correct and I built the ember app in the path before I installed ember-cli-rails. What could be the problem?

seanpdoyle commented 8 years ago

@LingboTang thanks for opening this issue!

c.app :frontend, path: "~/item_tracking/client/dist"

I built the ember app in the path before I installed ember-cli-rails.

Could you explain your use case?

Why are you building the ember app outside of ember-cli-rails?

Is c.app :itemtracking your ember application? Does it exist in Rails.root.join("itemtracking")?

Mentioning your ~/ directory could be a bad idea -- have you tried using a relative path?

What is the significance of pointing to the /dist directory?

As a reference, let's assume your Rails project existed in an item_tracking directory, and your Ember application existed in a client directory.

In that case, the following would be a proper configuration:

EmberCli.configure do |c|
  c.app :client
end
LingboTang commented 8 years ago

I developed my web app frontend in item_tracking/client with ember, and backend in item_tracking/server with ruby on rails, their communication is done by jsonAPI currently. I wanted to use ember-cli-rails to deploy my app, so I built the ember production first, trying to serve the index.html by rails server.

LingboTang commented 8 years ago

Now I changed it to:

EmberCli.configure do |c|
  c.app :client
  c.app :frontend, path: "/item_tracking/client"
end

But I still got the error

seanpdoyle commented 8 years ago

I developed my web app frontend in item_tracking/client with ember, and backend in item_tracking/server with ruby on rails

Given this directory structure, try this configuration:

EmberCli.configure do |c|
  c.app :frontend, path: "../client"
end

I wanted to use ember-cli-rails to deploy my app, so I built the ember production first, trying to serve the index.html by rails server.

This goes against the utility of the ember-cli-rails library -- the idea is that ember-cli-rails is responsible for communicating with and managing your Ember application.

Given your server and client directory structure, I'm assuming you aren't deploying to Heroku.

I recommend you consider integrating with ember-cli-deploy's "Lightning" deploy strategy via the ember-cli-rails-deploy-redis deployment strategy.

seanpdoyle commented 8 years ago

I'm closing this issue, since it stems from configuring an invalid path value .

LingboTang commented 8 years ago

That works, thank you