Rails keeps looking for a non-existent gem - ruby-on-rails

I've replaced the gem mysql2 for a sqlite3 in development environment. However Rails keeps looking for it. I've tried to delete Gemfile.lock and it didn't work. I've also changed the database.yml file.
This is the error when I do rails db:create
LoadError: cannot load such file -- /home/gn09/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/arel-9.0.0/lib/arel/visitors/mysql.rb

replace gem in Gemfile
#gemfile.rb
gem 'sqlite3'
database.yml
something like this
bundle
bundle update - update Gemfile.lock correctly
rails db:create db:migrate
rails s

First uninstall ruby
rbenv uninstall 2.6.1
Then install again to get a fresh set of gems
rbenv uninstall 2.6.1
Then install bundler
gem install bunder -v '2.1.4'
Then
bundle install

Related

LoadError issue with rails server

I am new to rails and I am having a problem with starting a web server. After I type in "rails server" in my terminal, I see the following error.
How can I fix this? I tried gem pristine stuff as suggested but it didn't work.
Try gem install bundler and install dependencies.
If bundler is not install, install bundler with command: gem install bundler
Install all gem with command: bundle install or bundle.
Then Configure your database to the database.yml.
Create new database: rake db:create
Then start rails server.
rails server or rails s

Ruby on rails error when running rails s

Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]

Bundler won't install mysql2

First of all I've gone through dozens of posting here on SO and google and haven't been able to find an answer.
I'm trying to install mysql2 with bundler and it won't do it.
Running on Ubuntu Server 11.04 Natty
Here's some background info:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
gem -v
1.8.24
rails -v
Rails 3.2.5
$ mysql --version
mysql Ver 14.14 Distrib 5.1.62, for debian-linux-gnu (x86_64) using readline 6.2
I have gem "mysql2", "~> 0.3.11" in my Gemfile
When I do bundle install it goes through the process and it finishes successfully (No Errors) but it doesn't install mysql2. When I do bundle show, mysql2 is not listed.
I've tried a gazillion of things recommended here and on forums and still can't get mysql2 to install with bundler.
Any ideas?
Thanks.
For mysql2 you need to install the dev files on your server.
try first:
sudo apt-get install libmysqlclient-dev
Then check first your GemFile in your RoR App Dir - I have this line in my GemFile:
gem 'mysql2', '0.3.11'
run bundle:
bundle install
or try the command from Emily first then run bundle install:
gem install mysql2 -v=0.3.11
bundle install
I hope it helps
So after many tries, reading, and pulling my hair out I found out what was the problem, so I'm posting it for those that might run into the same situation.
The reason why bundler wouldn't install mysql2 is because the gem was inside this platforms structure, see below:
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "0.3.11"
end
end
So all I did was to move just gem "mysql2", "0.3.11" by itself to the top of the Gemfile and run bundle install and that did it! Now mysql2 is listed under bundle show and my rails application is running now.
Thanks every one that tried to help!

Rake db:create mysql/rake version issues

I am following this backbone rails turotial.
The tutorial says they are using Ruby 1.9.2 and rails 3.0.3.
I am using Ruby 1.9.3, and I created an rvm gemset for this tutorial and installed rails 3.0.3 into the gemset.
I ran bundle install which installed mysql2 version 0.3.11
When I ran rake db:create I got this error:
WARNING: This version of mysql2 (0.3.11) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
So I ran:
gem uninstall mysql2
gem install mysql --version 0.2
rake db:create
Then I got this error:
Could not find mysql2-0.3.11 in any of the sources
Try running bundle install.
If I run bundle install it takes me back to the first problem.
Not sure what the I should try next.
place in Gemfile
gem 'mysql2','0.2.7'
then run
bundle install

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet
I have require gdata/speadsheet in /Users/me/myapp/vendor/gems/roo-1.2.3/lib/roo/google.rb
I cannot figure out how to install it.
Tried
gem install gdata_spreadsheet
gem install spreadsheet
gem install gdata
Which all seem to install, but still get
no such file to load -- gdata/spreadsheet
When
ruby script/server.
Any ideas on how to get this file?
Assuming you are using bundler for dependencies try adding the gem to your Gemfile:
gem 'gdata_spreadsheet'
Then use bundler to install your dependencies and start your server:
bundle
bundle exec script/server

Resources