Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku wrongly detecting my Node app as a Ruby app

I have a Node project that is using Bundler and Guard to handle my pre-compilations steps. This means that I have a Gemfile in the root of my project along with the package.json file.

My problem is that Heroku believes that my project is a Ruby app, just because the Gemfile exists. And complains that I have not committed the Gemfile.lock, which I don't want to commit.

-----> Heroku receiving push
-----> Ruby app detected
 !
 !     Gemfile.lock is required. Please run "bundle install" locally
 !     and commit your Gemfile.lock.
 !
 !     Heroku push rejected, failed to compile Ruby app

Is there a way to tell Heroku that the app is a Node app and not a Ruby app?

like image 902
andersjanmyr Avatar asked Apr 04 '12 09:04

andersjanmyr


2 Answers

The solution to this, with a lot of help from Heroku Support is: use a build pack!

Override the Heroku default buildpacks by specifying a custom buildpack in the BUILDPACK_URL config var

$ heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs

You can also specify a buildpack during app creation

$ heroku create -s cedar --buildpack https://github.com/heroku/heroku-buildpack-nodejs

Simple when you know it. Some more documentation can be found at Heroku Dev Center

like image 177
andersjanmyr Avatar answered Sep 30 '22 02:09

andersjanmyr


It seems there's a new way to do this as BUILDPACK_URL is now deprecated, explained here, but essentially the command is:

$ heroku buildpacks:set heroku/nodejs

You may also specify a buildpack during app creation:

$ heroku create myapp --buildpack heroku/nodejs

like image 38
Lounge9 Avatar answered Sep 30 '22 04:09

Lounge9