Heroku Wrongly Detecting My Node App as a Ruby App

Heroku wrongly detecting my Node app as a Ruby app

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

Forcing Heroku to Treat App as Node.js

Well crap, I must not have looked far enough. This was already asked on Stack Overflow and the answer was to use the custom Node.js build pack, a la:

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

Using Heroku for a Node web application

Ensure following things:

1- app has a package.json file in the root directory.

2- app has node version defined in package.json as:

"engines": {
"node": "4.1.1"
},

Edit: buildpacks fix,

heroku buildpacks:clear //clear buildpack

heroku buildpacks:set heroku/nodejs //set correct build pack for node.js app

OR

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs -a your-app-name

Why does Heroku fail to detect Node.js buildpack?

This means that a package.json file isn't checked into the root of your git project, so Heroku is detecting that it isn't a Node.js app. You can see this locally:

git show master:package.json

To fix it, you'll want to be sure there is a package.json in the root of your project (where there is also a .git directory), and add it to git:

git add package.json
git commit -m 'track package.json'

The phrasing ('failed to detect set buildpack') could be improved. It should probably say 'failed to detect Node.js app'. When the buildpack's "detect" script is run (https://github.com/heroku/heroku-buildpack-nodejs/blob/master/bin/detect), it looks for a package.json file to verify that there's a node app available to build.

Heroku push rejected, no Cedar-supported app detected

The problem was that my "Gemfile" was named "gemfile"

heroku push rejected, failed to compile Ruby/rails app

try this,

remove Gemfile.lock file and do bundle install , then git add, git commit and git push .

Push rejected, failed to compile Node.js app heroku

The easiest way to make this work is to add node_modules to your .gitignore. Lots more info here: Fail to deploy node.js application to heroku

heroku push error: Could not detect rake tasks

Sometimes Heroku throws an issue on deployment about assets. You can precompile assets and push it to Heroku.

RAILS_ENV=production bundle exec rake assets:precompile

Update:

In case of it doesn't work, make sure to add
RAILS_SERVE_STATIC_FILES env. to yr server.

Make it enabled or true nor anything :)

Because in Rails <5.1 production.rb has

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

Heroku: App -> Settings -> "Reveal Config Vars"

Sample:
Sample Image

Invalid path in Heroku

There must be a bit of misstep somewhere in your process, I created a sample app, using the following commands - hopefully this will help you identify where things aren't going right.

Just the list of commands:

$ rails new sample_app
$ cd sample_app/
$ git init
$ git add .
$ git commit -m "Initial commit"
$ heroku create
$ git push heroku master
$ heroku open

And the commands, with some truncated output:

$ rails new sample_app
create
create README
create Rakefile
create config.ru
create .gitignore
# ..snip..

$ cd sample_app/

$ git init
Initialized empty Git repository in /sample_app/.git/

$ git add .

$ git commit -m "Initial commit"
[master (root-commit) 487a313] Initial commit
37 files changed, 1138 insertions(+), 0 deletions(-)
create mode 100644 .gitignore
create mode 100644 Gemfile
create mode 100644 Gemfile.lock
create mode 100644 README
# ..snip..

$ heroku create

$ git push heroku master
Counting objects: 63, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (63/63), 24.81 KiB, done.
Total 63 (delta 2), reused 0 (delta 0)

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Installing multi_json (1.0.3)
Installing activesupport (3.1.0.rc6)
# ..snip..

-----> Compiled slug size is 5.6MB
-----> Launching... done, v4
http://gentle-water-874.heroku.com deployed to Heroku

To git@heroku.com:gentle-water-874.git
* [new branch] master -> master

$ heroku open


Related Topics



Leave a reply



Submit