Heroku deployment fails with build error, using Foundation 5 and Bower. Local builds are successul

Local builds are successful, but deploying to Heroku fails on build. Appears to be related to ‘Precompiling Assets.’ Any help or direction would be great - thanks!

I’m using Middleman with Foundation 5, which uses Bower dependencies that appears to be the cause of breaking during the build on Heroku deployment.

Error snippet:

remote:        from vendor/bundle/bin/middleman:16:in `load'
remote:        from vendor/bundle/bin/middleman:16:in `<main>'
remote:        rake aborted!
remote:        Command failed with status (1): [middleman build...]
remote:        /tmp/build_31ad14ee6e4fef7d3ecd248b26518a72/Rakefile:3:in `block (2 levels) in <top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app

Full error found here.

Full source and configuration found here.

Additional note, if I build Middleman locally and then push the /build directory to Heroku it successfully deploys. So error is definitely pointing to the build process on Heroku.

I prefer to have the build step occur on the server side though, and have successfully done this using Middleman and Foundation 4 (non-Bower dependency).

Why are you even “deploying” to Heroku? Middleman is a static site generator. Just build what you need and host the static files elsewhere.

You’re getting the error because you’re not using Middleman as intended.

You’ll see that Heroku says:

remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using bundler 1.9.7

Heroku has detected a ruby app and is installing dependencies with ruby via bundler. Bower uses NPM, which is Node.

If you comb through the log more, you’ll see:

remote:        /tmp/build_31ad14ee6e4fef7d3ecd248b26518a72/source/assets/stylesheets/foundation_and_overrides.scss:9: File to import not found or unreadable: foundation/functions. (Sass::SyntaxError)

The problem is that it cannot find foundation, which is a bower component. You could try to see if foundation has a ruby gem.

But really, you should be reconsidering “deploying” at all.

Thanks for your suggestion not to use Heroku servers, however it is a project requirement. I’ve had success serving static websites, including Middleman generated sites via Heroku.

The goal is to automate the deployment process by moving the build step to Heroku. A single command to push, build, and deploy the project. Foundation4 and Middleman worked without issue, however Foundation5 introducing Bower to the asset pipeline - which is where all the error are pointing. Still appears to be a path issue for asset pipeline, I just can’t find the disconnect.

Regarding the Heroku errors log for Ruby and Bower, I think you may be switching the two. Those are correct and expected log lines from Heroku. Middleman is indeed a Ruby application, Heroku detects a Ruby app, then issues the Middleman build command. Bower is using NPM to manager the Foundation5 library and other assets, not the actual application. Foundation4 is build as a Ruby Gem, Foundation5 uses Node NPM as you noted.

Thanks for taking a look. I’m still troubleshooting, hope to find more info and share.