I cant upload to Heroku RUBY ON RAILS - ruby-on-rails

Hello I have a little problem, I push my project (Rails) normally on github without any problem I connect it normally to heroku and when I try to do git heroku push master, it displays this to me =>
enter image description here
I saw that this is a gemfile problem, because a friend's gemfile.lock is working on my project when I try to upload
RAILS : Rails 5.2.4.5
BUNDLER : Bundler version 2.2.14
RUBY : ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin20]

Since the problem is with bundle install, have you done all what is expected with heroku like using the gem pg instead of sqlite3?

Related

Why does this happen when i try to update rails to 4.0.0?

I pulled someone's project from github, and we seem to be using different rails versions. When i update the rails gem, it seems to go fine, but when i check the version it still shows the previous one and won't run the rails server.
me#ubuntu:~/Documents/RailsProjects/vega$ gem install rails
--version=4.0.0
Successfully installed rails-4.0.0
Parsing documentation for rails-4.0.0
Done installing documentation for rails after 0 seconds
1 gem installed
me#ubuntu:~/Documents/RailsProjects/vega$ rails -v
Rails 3.2.6
You have multiple Rails versions installed and it's reporting the first one it finds.
Does the project have a gemfile? If so just let bundle handle this for you:
bundle install
bundle exec rails s

Ruby version in the Gemfile

The Ruby on Rails Tutorial by Michael Hartl uses a Gemfile without specifying a Ruby version: the ruby keyword is missing in all the applications.
When I deploy to Heroku I receive the following warning:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.2.4'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
The tutorial says that "the costs associated with including such an explicit Ruby version number outweigh the (negligible) benefits, so you should ignore this warning for now. The main issue is that keeping your sample app and system in sync with the latest Ruby version can be a huge inconvenience".
I am wondering whether the alternative is to keep the pace with the Ruby version at Heroku (presumably 2.2.4 at present), as the book seems to suggest, or also to specify any Ruby version it suits me. In other words, since I am using Ruby 2.2.1p85 for my application, adding ruby "2.2.1", :patchlevel => "85" would work and make Heroku adjust to this version or rather I am supposed to adjust to Heroku and add as suggested ruby '2.2.4'?
I am using rvm and a specific gemset with a specific Ruby version, for no other reason than trying to use an environment as much close to the tutorial as possible. What is the best practice in a real context? Would you suggest to use the last Ruby version and include it in the Gemfile? Can the Gemfile leave out the Ruby version with no worries?
Please follow the steps to solve
You can check which ruby version is associate with your app by command
heroku run "ruby -v"
It is good to have default version of ruby which is 2.2.4 in order to solve your problem. If your ruby version is older than 2.2.4 then please upgrade it.
after checking/upgrading version You can use the ruby keyword in your app’s Gemfile to specify a particular version of Ruby.
source "https://rubygems.org"
ruby "2.2.4"
You will need to install and update bundler again
$ gem install bundler
$ bundle update
This command:
heroku run rake db:migrate
solved same problem

Why Heroku is still not using my Ruby version 1.9.3?

I followed every step in here:
I have this in my gem file
ruby "1.9.3"
and then when I deploy heroku says:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using 1.5.2
Then when I do
heroku run "ruby -v"
I still get
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Then I added a path:
heroku config:set PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
Deployed again, and still same result:
I tried:
heroku config:set PATH=bin:vendor/bundle/ruby/1.9.3/bin:/usr/local/bin:/usr/bin:/bin
Still no use:
In my heroku Log I get this:
/app/vendor/bundle/ruby/1.9.1/gems/bundler-1.5.2/lib/bundler/definition.rb:390:in `validate_ruby!': Your Ruby version is 1.9.2, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
It kind of is driving me nuts, I can't get Heroku to use 1.9.3.
I looked at the following questions as well:
Ruby version is not upgrading on Heroku
Is it possible to run my Rails app on Heroku with Ruby 1.9.3? If so, how?
How can I choose Ruby version on Heroku?
Heroku cedar doesn't upgrade to ruby-1.9.3
Still can't get anywhere
After a very painful search by removing and adding stuff from my most recent commit I realized that a file .bash_profile was added to my Rails Root app that had this in it:
export PGHOST=localhost
export PATH=/usr/local/bin:$PATH
So I just removed that, because this calls up the path to the Ruby version, the default one.
I hope no one ends up making same mistake.

cloudfoundry rails 3.2.3 ruby 1.9 deploy error

I am new to cloudfoundry and rails, I am trying to deploy a new application to cloudfoundry, and I got this error:
====> /logs/migration.log <====
←[31mYou have requested:
mysql2 ~> 0.3.11
The bundle currently has mysql2 locked at 0.3.11.
Try running `bundle update mysql2`←[0m
I downloaded a few rails samples from here:
https://github.com/cloudfoundry-samples
with the same results.
I already tried 'bundle update mysql2'
If I push a simple ruby app that requires the gem mysql2 it works fine.
I am using windows 7 x64.
Any ideas?
Thanks.
There is an issue with deploying ruby apps bundled on Windows to CloudFoundry.com (which is Linux-based). The workaround is to modify your Gemfile.lock and delete occurrences of the string -x86-mingw32. Then re-push the app to Cloud Foundry.
can you confirm that you have run;
bundle update
bundle package
before using VMC to push the application.

Error while running rails on windows 7

I am trying to set my machine up so I can follow this tutorial: the intro to rails screen-cast i wish i had.
I keep running into issues, most recently the following:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ansi-1.4.1/lib/ansi/code.rb:5:in `require':
no such file to load -- Win32/Console/ANSI (LoadError)
This occurs when ever I run rails g. (I would like to see if my r spec generator has been added.)
Environment details: Windows 7, ruby 1.9.2p290, rails 3.1.1, rubygems 1.8.15
After you installed "gem install win32console", can you add this gem into your Gemfile file and try to run bundle install again?
Gemfile
gem "win32console", "~> 1.3.0"
RailsInstaller may be your best bet if you're looking for an integrated Windows Rails experience.
It's up-to-date (-ish, doesn't use Ruby 1.9.3) with:
Ruby 1.9.2-p290
Rails 3.1.1
Git 1.7.6
and other useful bits.

Resources