Gem is not checked out. Please run `bundle install` in Heroku - ruby-on-rails

I have this configuration in my Gemfile:
group :test do
# ...
gem "shoulda-matchers", :git => "git://github.com/watu/shoulda-matchers.git", :branch => "do_not_load_minitest"
end
which works fine locally, but when I push to Heroku, when I try to run rake db:migrate, I get this error:
git://github.com/watu/shoulda-matchers.git (at do_not_load_minitest) is not checked out. Please run bundle install
Indeed I don't see it in the output of bundle install being run on Heroku, maybe because it's on the test group and Heroku is not installing the test group. But then, why is it complaining when I run rake db:migrate? should it run in staging env?
I tried switching to the http url and all I got is the same error with another URL:
https://github.com/watu/shoulda-matchers.git (at do_not_load_minitest) is not checked out. Please run bundle install
Moving the line outside the :test group workarounded the problem. What's the proper solution?

If you don't really need that gem (since it is in :test group), you can add this configuration to your app:
heroku config:add BUNDLE_WITHOUT="development:test" --app <your_app>

Related

"bundle exec rake" doesn't honor "without"

On a GitLab installation from source, I'm having problems running binaries such as rake. I've never seen similar problems with my own Ruby or Rails projects:
# bundle config
Set for your local app (/mnt/data/www/gitlab.bitcetera.com/source/gitlab/.bundle/config): "1"
path
Set for your local app (/mnt/data/www/gitlab.bitcetera.com/source/gitlab/.bundle/config): "vendor/bundle"
without
Set for your local app (/mnt/data/www/gitlab.bitcetera.com/source/gitlab/.bundle/config): "development:test:unicorn:mysql:kerberos:metrics"
disable_shared_gems
Set for your local app (/mnt/data/www/gitlab.bitcetera.com/source/gitlab/.bundle/config): "true"
# bundle install --deployment --without development test unicorn mysql kerberos metrics
# bundle config
The Gemfile's dependencies are satisfied
# bundle exec rake --tasks
rake aborted!
LoadError: cannot load such file -- haml_lint/rake_task
Looking at the relevant section of the Gemfile:
group :development, :test do
[...]
gem 'haml_lint', '~> 0.21.0', require: false
[...]
end
Of course the haml_lint gem is missing, after all, it's in the "development" and "test" groups only which I've excluded by "without".
Any idea what's going on here?
Figured it out, kinda daft reason: RAILS_ENV should have been set automatically yet it wasn't so of course things go awry.

Heroku run rake db:migrate error rake command not found

I'm running the run rake db:migration command and terminal is telling me that rake is not a command
$ heroku run rake db:migrate --app"glacial-lake-5597"
Running `rake db:migrate --appglacial-lake-5597` attached to terminal... up, run.1930
bash: rake: command not found
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.4588
bash: rake: command not found
i've already bundle installed and committed changes to git.
I've looked all over StackOverflow and I cannot find the answer
Can someone point me in the right direction
I had the same problem,
The cause was that I hadn't specified a remote branch when first pushing to Heroku, Heroku apps start with a blank repository – they have no branches and no code. So the first time you deploy, you need to specify a remote branch.
git push heroku master
I hadn't done this initially and in doing so this fixed my rake problem.
See if the gem sqlite is in development only.
like this
group :development do
gem 'sqlite3'
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
To check to see if your app deployed correctly just look at the trace in your shell after you attempt to push to Heroku. I had been running mine in Cloud 9 and not really looking at the results because they were so small, I'm new to this, and, heck, it had always deployed perfectly before....
When I scrolled through I found two errors mentioned; I corrected these errors, then the heroku db migration ran fine. One error was a missing line of code, the other I found on SO (which I can't refind the link to, sorry), and it had to do with the file extensions for my css files, which I changed from .css to .css.scss.

Heroku rake db:migrate doesnt work

im having this issue when i try to deploy my ruby on rails application to heroku, i check different posts here, because i saw this issue before but i couldnt fix it.
when i try to run:
$ heroku rake db:migrate
I get a lot of these ones: DEPRECATION WARNING:
and then:
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)
I tried to change my Gemfile with 'pg' and my group :assets do to :production, i know im missing something but i could'nt figured out what.
Some ideas?
Also when I go to the app url, I get this:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Thanks in advance for any suggest and help!!!
You have to use Postgres on Heroku, you can't use sqlite3 because Heroku prohibits you from saving to the file system. So add the pg gem to your production bundle and re-deploy then your migrations should run.
Answer here is simple, add the following production in your gemfile as:
group :production do
gem 'pg'
end
Your local machine won't work with this production, so we now have to bundle it by ignoring PostgreSQL gem which can be done as:
bundle install --without production
After this, try heroku rake db:migrate. Must work.
Good luck

Rails Tutorial Sample_App fails on Heroku

I reading Rails Tutorial and created a Sample_App.
My code is available here: https://github.com/namic/sample_app
Heroku is running the app here: http://afternoon-mist-7865.herokuapp.com/
It works in test, development and production environment on my laptop, but Heroku denies me the joy with "We're sorry, but something went wrong."
Any suggestions?
Solution:
Add to Gemfile:
group :production do
gem 'pg'
end
And remember to run bundle install without production, if you dont want postgresql local:
bundle install --without production
Check the logs and make sure you ran the migrations on heroku.
heroku run rake db:migrate

heroku rake db:migrate rake aborted! unable to open database

I am currently making my way through the Ruby on Rails tutorial over at http://ruby.railstutorial.org/ and I am trying to migrate the demo_app database to heroku.
heroku rake db:migrate
rake aborted!
unable to open database file
I have read on other stackoverflow posts that some people fixed this by entering
group :production, :staging do
gem "pg"
end
group :development, :test do
gem "sqlite3-ruby", "~> 1.3.0", :require => "sqlite3"
end
in the gemfile. I also entered it into my gemfile and then deleted my old gemfile.lock and redid my bundle install AND rake db:migrate command. I am still receiving the same error.
I am obviously brand new to ruby, rails and heroku but I understand that the problem seems to be that I am using sqlite locally and postgresql in production (on heroku). Do I now have to install this postgresql onto my machine and then RE-migrate the DB? I am afraid I will not be able to get much more out of the tutorials (or ruby on rails itself) if I cannot use heroku.
Kill it!
I was having the same problem and found no solutions. I think something we are doing in those tutorials is leading us to mangle the database.yml file that heroku generates.
I ended up destroying my heroku app
heroku destroy
and then creating a new one, pushing a fresh copy, and running
heroku create
git push heroku master
heroku rakedb:migrate
This time everything worked fine! Just make sure you have the pg gem in your gemfile for production
group :production do
gem "pg"
end
and add config/database.yml to your .gitignore file too for good measure.
or if it's working ok locally do a heroku db:push to magically put your local sqlite DB into Heroku's postgresql db.
I always work with the same DB platform locally just so I don't run into any differences (usually only when you start doing DB specific SQL) so I run Postgresql locally too.
Had the same problem... with Heroku interface... ran:
heroku rake db:migrate --trace
and found the problem to be with faker, not being found...Since 'faker' in our Gemfile is loaded in the development group, I loaded it in the production group as well.
saved Gemfile
bundle install
git add .
git commit -m "fixed faker"
git push
git heroku push
heroku rake db:migrate
heroku rake db:populate
now everything works...the QUESTION, now is what to do with 100 users on my production site?
At least I can continue with Hartl's tutorial!!

Resources