Rails v6.0.0 push to Heroku fails - Rake & Bundler error msgs - rake

This is my first attempt to push a Rails v6.0.0 app to Heroku. The error msgs are:
Could not detect rake tasks
ensure you can run `$ bundle exec rake -P` against your app
and using the production group of your Gemfile.
Activating bundler (2.0.1) failed:
Could not find 'bundler' (2.0.1) required by your /tmp/build_94b6a9e04d812c465a5480f59429532e/Gemfile.lock.
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.0.1`
Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
I can run 'bundle exec rake -P', no problem.
I have verified that bundler 2.0.1 is installed, no problem.
Suggestions?

A similar bugreport on the bundler repo mentions that bundler 2.0.1 conflicts with heroku. I've copied the following fix instructions from that comment:
gem install bundler -v 2.0.2
bundle update --bundler
commit & push Gemfile.lock changes in your repo
deploy with git push heroku master

Related

Bundle install is throwing error when installing coffee-script-source -v '1.6.3'

I'm using Ruby 2.0.0 and Rails 4 but I'm getting an error with coffee-script when I generate new rails project
Installing coffee-script-source (1.6.3)
Errno::EACCES: Permission denied - /usr/local/rvm/gems/ruby-2.0.0-p247/build_info/coffee-script-source-1.6.3.info
An error occurred while installing coffee-script-source (1.6.3), and Bundler cannot continue.
Make sure that gem install coffee-script-source -v '1.6.3' succeeds before bundling.
I just ran into the same problem. Run
sudo bundle update
inside your new site directory. Ruby will then have no trouble installing whatever packages it needs to.
I has the same issue and came across your post when I googled it. I had to run:
sudo gem install turbolinks -v '1.3.0'
sudo gem install uglifier -v '2.2.1'
sudo gem install multi_json -v '1.8.2'
before I could get the bundle install to complete. However, if you are reading the rails tutorial (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-rubygems), it says not to worry if that stage fails, as the railsgem file is updated and you manually run:
bundle update
bundle install
Hope this is of some help.
do once: sudo rails new demo
and then for other projects just rails new project_name

Installing redmine_contacts plugin for bitnami_redmine

I am trying to install redmine_contacts plugin for my redmine 2.2.3.0 (which is installed using BITNami installer), as in readme.rdoc:
Copy redmine_contacts plugin to {RAILS_APP}/plugins on your redmine path
Run bundle install --without development test RAILS_ENV=production
Run rake redmine:plugins NAME=redmine_contacts RAILS_ENV=production
The first two steps was successful, but last executing last command, following error would occur:
(in /home/.../redmine-2.2.3-0/apps/redmine/htdocs)
Could not find sprockets-2.2.1 in any of the sources
Run bundle install to install missing gems.
To see if the sprockets library is installed by executing command: #bundle show sprockets, it shows a newer version of this library is installed:
/var/lib/gems/1.8/gems/sprockets-2.2.2
I think somehow the BitNami version of gem which is installed is not compatible with the sprockets-2.2.2 on the system and it requires 2.2.1. Maybe you should change to that version.
Try something like:
gem install sprockets -v 2.2.1

Deploy to Heroku Error

I am failing to deploy my first app to Heroku. An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that **gem install sqlite3 -v '1.3.6**' succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
After the I modified the Gemfile and installed sqlite3 1.3.6 by using the command:
user$ gem install sqlite3 1.3.6
I got:
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.6
ERROR: Could not find a valid gem ',' (>= 0) in any repository
ERROR: Could not find a valid gem '~>1.3.6' (>= 0) in any repository
1 gem installed
Installing ri documentation for sqlite3-1.3.6...
Installing RDoc documentation for sqlite3-1.3.6.
Just a note, I have deleted the Gemfile.lock but haven't committed the changes. Please help me install the necessary gems to deploy to Heroku

Why is bundler not able to install rake even though rake appears to be present?

I'm having some trouble with rbenv and bundler. When I bundle install on my app, I get an error saying that an error occurred while installing Rake.
I'm thinking this has something to do with rbenv not pointing to the write path for gems -- but I'm not positive.
Why is bundler not able to install rake when rake appears to be present?
Console Output
deploy#telemed-test:/u/apps/telemed_solutions/current$ bundle install
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
NoMethodError: private method `open' called for Gem::Package:Class
An error occured while installing rake (0.9.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2'` succeeds before bundling.
deploy#telemed-test:/u/apps/telemed_solutions/current$
deploy#telemed-test:/u/apps/telemed_solutions/current$ rbenv version
1.9.3-p125 (set by /home/deploy/.rbenv/version)
deploy#telemed-test:/u/apps/telemed_solutions/current$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
bundler (1.1.3)
io-console (0.3)
json (1.6.6, 1.5.4)
minitest (2.12.1, 2.5.1)
rake (0.9.2)
rdoc (3.12, 3.9.4)
It might be time to upgrade rubygems. Some of the specification files may be calling rubygems methods that don't exist in your version.
Run gem --version to check your current version.
And gem update --system to upgrade to the latest.

Rails 3.1 - Pushing to Heroku - Errors installing postgres adapter?

I just upgraded to Rails 3.1 and the first app i've tried to deploy to Heroku has encountered a problem relating to Postgres adapter. I'm able to push the app to heroku but then when i try to migrate the database i get the following error:
heroku rake db:migrate
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
(pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
when I try their suggested install i get:
ERROR: Could not find a valid gem 'activerecord-postgresql-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-postgis-adapter, activerecord-jdbcpostgresql-adapter, activerecord-postgresql-cursors, activerecord-jdbcmysql-adapter, activerecord-jdbcmssql-adapter
which already seems weird... so what exact gem should I install to get this thing working if not what they say I should install??
When I try installing gem pg i get:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/jerometufte/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
...
I'm using SQLite3 currently. Any help greatly appreciated, this is baffling me.
Option 1:
Add pg to your Gemfile but skip trying to install it locally.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Skip attempting to install the pg gem
$ bundle install --without production
Option 2 (Debian/Ubuntu):
Add pg to your Gemfile but first install the prerequisites.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Install the pg gem's dependencies first
$ sudo apt-get install libpq-dev
# Then install the pg gem along with all the other gems
$ bundle install
You definitely need pg in the Gemfile for Heroku.
About the error you're getting locally: make sure you have postgres installed, run gem install pq -- --with-pg-config=[path to wherever your pg-config binary is], then bundle install.
Alternatively, if your local database is working fine (either because you're using sqlite or postgres-pr), you could put the gem 'pg' line in your Gemfile in a group called production, then bundle install --without production locally.
More up-to-date info: It had something to do with a different version of pg gem locally.
I already had pg in a production group (I run sqllite locally), but Heroku was still puking.
The problem went away for my new Rails 3.1 app when I:
rm Gemfile.lock
touch Gemfile
bundle install
git add .
git commit -am "wiped Gemfile.lock re-ran bundle install"
git push heroku master
worked like a charm when I then ran heroku run rake db:migrate