Jody Heavener
Jody Heavener

Reputation: 2874

Heroku build failing - Sprockets::ArgumentError: require_tree argument must be a directory

I'm trying to push my Rails 3.2 app up to Heroku, but the push gets rejected because Sprockets can't find the directory I'm referencing with require_tree.

In app/assets/javascripts/application.js:

//= require_tree ../../../vendor/assets/extender/

The error portion of the build looks like:

Running: rake assets:precompile
rake aborted!
Sprockets::ArgumentError: require_tree argument must be a directory
(in /tmp/.../app/assets/javascripts/application.js:1)

As I understand it items under vendor/assets/ should be available as though they were under app/assets/, but I can't seem to get that to work and the way I'm doing it above works locally, so I'm running with it.

What I don't understand is why this works locally but not when pushing to Heroku. Any help is greatly appreciated!

Upvotes: 1

Views: 1564

Answers (2)

Jody Heavener
Jody Heavener

Reputation: 2874

Solved: for some reason my .gitignore was ignoring /vendor.

Upvotes: 3

Leonel Galán
Leonel Galán

Reputation: 7167

app/assets/javascripts and vendor/assets/javascripts get merged into the same level, so you should require_tree extender if vendor/assets/javascripts/extender/ exists.

You shouldn't go have to do ../../../vendor/assets/javascripts/. See Search Paths in http://guides.rubyonrails.org/asset_pipeline.html#asset-organization

Upvotes: 0

Related Questions