3

I am using the app generated from the official express generator, and CEDAR stack on heroku.

I get the following error when I try to access a stylesheet (/stylesheets/style.css) All the other static assets are loading without problem, and the sass version of the stylesheet (/stylesheets/style.scss) also.

What could be the issue?

2015-03-09T22:27:54.648677+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/stylesheets/style.css" host=**.herokuapp.com request_id=c29b6d81-3dae-4e3f-a35a-53f3dea3fb48 fwd="80.244.17.16" dyno=web.1 connect=0ms service=167ms status=503 bytes=0
2015-03-09T22:27:54.589437+00:00 app[web.1]: events.js:85
2015-03-09T22:27:54.589449+00:00 app[web.1]:     at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
2015-03-09T22:27:54.589447+00:00 app[web.1]:     at exports._errnoException (util.js:746:11)
2015-03-09T22:27:54.589444+00:00 app[web.1]:             ^
2015-03-09T22:27:54.589442+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2015-03-09T22:27:54.589446+00:00 app[web.1]: Error: spawn compass ENOENT
2015-03-09T22:27:54.589452+00:00 app[web.1]:     at process._tickCallback (node.js:355:11)
2015-03-09T22:27:54.671202+00:00 app[web.1]: 
2015-03-09T22:27:54.589451+00:00 app[web.1]:     at child_process.js:1137:20
AdrieanKhisbe
  • 3,899
  • 8
  • 37
  • 45
Stefanos Chrs
  • 2,228
  • 3
  • 19
  • 46
  • Hello, are you using node-compass middleware ? – Benoit Guigal Mar 10 '15 at 21:28
  • 1
    Then this is related to this bug https://github.com/nathggns/node-compass/issues/34. Compass gem should be installed on your host machine for node-compass to work – Benoit Guigal Mar 11 '15 at 08:15
  • Heroku Support suggested adding this build pack ```https://github.com/stephanmelzer/heroku-buildpack-nodejs-grunt-compass``` but I still get that error. – Stefanos Chrs Mar 12 '15 at 09:21
  • I don't know exactly how Heroku works but it seems to me it is pretty hard to fine tune what software is installed. You might consider deploying to a cloud service where you will get more control. I find [DigitalOcean](https://www.digitalocean.com/) very easy to use. – Benoit Guigal Mar 12 '15 at 10:07

1 Answers1

2

After a lot of troubleshooting I finally got to the bottom of it.

  • heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
  • create a file named .buildpacks in the root directory and add the following https://github.com/heroku/heroku-buildpack-nodejs.git https://github.com/heroku/heroku-buildpack-ruby.git
  • create a file named Gemfile in the root directory and add source "https://rubygems.org" gem "compass"
  • since heroku can't properly populate the Gemfile.lock you also have to create a file named Gemfile.lock and run bundle install
  • Push to heroku and node-compass works :)
Stefanos Chrs
  • 2,228
  • 3
  • 19
  • 46
  • 1
    Awesome! Can you share where you found all this? This solved my problem. I wonder if its something we can PR into the express generator because its a pain in the ass. – JDillon522 Apr 29 '15 at 11:58
  • @JDillon522 I took a lot of searching and this came up by following Error to Error – Stefanos Chrs Apr 29 '15 at 11:59
  • @StefanosChrs this works for me too. I was just using SASS with a `"postinstall": "grunt build"` step. I had to switch the order and install ruby first, but everything worked brilliantly. Thanks :) – Quang Van May 02 '15 at 03:12