I've set the JAVA_HOME variable
heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
checked that heroku config shows this variable with value,
then pushed:
git push heroku master
and still get
JAVA_HOME is not set
error while bundler is installing RJB gem.
I can successfully deploy the same source to another Heroku application, and all environment variables are the same.
What is wrong?
I had the same question, and in case anyone else wants to know, this is what Heroku told me:
By default the config variables aren't made available when the
application is compiled - only at runtime.
You can change this by making sure you have the latest heroku gem
install, then enable the user_env_compile lab flag
$ heroku labs:enable user-env-compile
this will make JAVA_HOME available when the gem installs, hopefully
getting you past this issue.
First find JAVA_HOME PATH by using,
heroku run 'which java |xargs readlink -f | sed "s:bin/java::"'
It will return you,
usr/lib/jvm/java-6-openjdk/jre
Using this now you came know about JAVA_HOME path on heroku. Now set JAVA_HOME path in heroku and in Gemfile
on heroku cli :
heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
In Gemfile on top :
java_home = '/usr/lib/jvm/java-6-openjdk'
ENV['JAVA_HOME'] = java_home if Dir.exist?(java_home)
Got Heroku to install gems that depend on $JAVA_HOME by adding the following to my Gemfile:
# set JAVA_HOME so Heroku will install gems that need it
heroku_java_home = '/usr/lib/jvm/java-6-openjdk'
ENV['JAVA_HOME'] = heroku_java_home if Dir.exist?(heroku_java_home)
Have you tried deploying your app to a different stack?
I did a little searching and this seems to fit your explanation.
https://github.com/carlhuda/bundler/issues/1742
probably yours report, isn't it?
I would advice you to contact Heroku and ask them to look into it.
It seems like it's missing dependencies which may, not be available on your current stack.
for migration from heroku cedar-14 to heroku-16 or heroku-18
$ heroku config:unset JAVA_HOME #remove JAVA_HOME env if exists
$ heroku stack:set heroku-18
$ heroku buildpacks:add --index 1 heroku/jvm
$ git push heroku master
To deploy to the heroku-20 stack, make sure you add the following build packs in this order:
heroku buildpacks:add heroku/jvm
heroku buildpacks:add heroku/ruby
You do NOT need to set JAVA_HOME manually with heroku-20. Nor will Heroku set it for you. The variable is already internally available to rjb when it is being installed.
Your final result should look like this:
Related
I tried to migrate my app to cedar-14 stack, but when i do:
heroku stack:set cedar-14
i ve got the message: stack:set` is not a heroku command
What can i do please?
Thanks
Please use following command to move from cedar to cedar-14
heroku stack:migrate cedar-14 -a <app name>
This error indicates your version of the heroku toolbelt doesn't know this command. You should update to the latest version.
You can check the version you have installed with the heroku version command:
heroku version
heroku-toolbelt/3.42.20 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/4.26.1-bf7a4d8 (amd64-darwin) go1.5.1
The heroku update command should update you to the latest version. If that doesn't work, try reinstalling it from scratch: https://toolbelt.heroku.com/
You also need to make sure you aren't using the gem version of the toolbelt, which has been deprecated for several years. Uninstall it with the gem uninstall heroku command.
I have downloaded the Heroku toolbelt a few times but whenever I run
heroku version
I am getting
heroku-gem/1.6.3
I have tried to uninstall the heroku gem but I can't seem to use the heroku toolbelt. What's the correct process to use the toolbelt?
Thanks!
it's likely coming from a Gemfile that is including the heroku gem. Remove it from there.
Alternatively you could include the toolbelt higher in the PATH environment variable than your ruby gems.
I was having the same problem, this what I did:
Install the heroku-toolbelt from the webpage.
go to /usr/local/heroku/bin and run ./heroku version this will throw the version of the current bin, problably this is the version you want to use.
run which heroku this will throw you a path, if the path is diferent that /usr/local/heroku/bin then just: rm -rf path
restart your console/terminal run heroku version
if dosn't work probably you need to add /usr/local/heroku/ to your $PATH.
restart and thats all
I was using oh-my-zshell with the heroku plugin which gave me the error and this is how i solve it, hope work for you.
#UPDATE
I restart and suddenly I had the same error again :/ and I fixed by:
gem uninstall heroku and rbenv rehash
I can find my apps in heroku apps command, and also do some command to read information from app like heroku addons --app appname.
But I couldn't find my apps in some command like heroku addons:add addon_name, heroku pg:reset.
Work commands
heroku apps:
=== My Apps
my_app_1
my_app_2
(Also I can see my apps in heroku web dashboard.)
heroku addons --app my_app_1(not in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
heroku addons(in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
Doesn't work commands
heroku addons:add sendgrid(in my_app_1 folder):
! No app specified.
! Run this command from an app folder or specify which app to use with --app
heroku pg:reset DATABASE --confirm my_app_1(in my_app_1 folder):
Resetting SHARED_DATABASE (DATABASE_URL)... failed
! Resource not found
Here is my environment.
Max OS X Lion (10.7.4)
rvm 1.13.8 (stable)
ruby 1.9.3p194
heroku 2.26.5
Adding the heroku's remote configuration to git did the trick for me. Validate if you have it configured with git remote -v on the terminal and you should get something like:
heroku git#heroku.com:your-app.git (fetch)
heroku git#heroku.com:your-app.git (push)
if you don't, add it with
git remote add heroku git#heroku.com:your-app.git
It looks like the latest version fo the Heroku gem (2.26.5) is broken. A workaround is to downgrade to 2.26.3.
gem uninstall heroku -v 2.26.5
gem install heroku -v 2.26.3
It looks like you have a conflict between the Heroku gem, and the Heroku Toolbelt. I'm guessing you have installed the Heroku Toolbelt, but still have the Heroku gem in your gem file.
Remove the Heroku gem from your Gemfile and save.
Run the bundle command to update your Gemfile.lock
In Terminal, run gem uninstall heroku (NOTE: there may be multiple versions of the Heroku gem installed, and you'll need to uninstall all of them.)
In Terminal, run heroku addons
If you get heroku: command not found then you don't have the Heroku Toolbelt installed.
Install the Heroku Toolbelt and run the command again.
NOTE: If you're not in the app's directory, you'll need to add --app myapp1 to the Heroku commands.
Hope this helps.
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?
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
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
I am learning ruby from this guide http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:deploying, and I am trying to install and make heroku to work. I added heroku to the PATH variable, (I am using ubuntu) bun when i type #command: herokuit returns this:
"/usr/lib/ruby/1.8/rubygems.rb:779:in 'report_activate_error': Could not find RubyGem heroku (>=0) (Gem::LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:214:in 'activate'
...
...
..."
Looks like you haven't installed the Heroku gem;
sudo gem install heroku