Sqlite3 errors on migrate, nokogiri errors on bundle install, gem conflicts after migrating to Rails3 & doing some merging. (Mac)
Wow, Update, solved!! I added a line into the gemfiles to tell it the range for my mac version of nokogiri, like it says here: Make bundler use different gems for different platforms, if you search for Stefan. It appears crossing from windows to mac development was the culprit.
Learning how gems work on a mac with rails3, because I'm having sqlite3 / nokogiri / gem / bundler issues with Ruby & Rails3 (on my mac)...
The problems starting just after upgrading to Rails 3.0.4 and ruby 1.9.1. Also, my teammate is coding in Windows and I'm on a Mac. My friend just upgraded the project to Rails3, while on his Windows PC, and now I've cloned it onto my Mac with Git...and am getting these errors.
When I do "rake db:migrate" on our project, I get this error in red in shell:
*You have requested: sqlite3 >= 0
The bundle currently has sqlite3 locked at 1.3.3.
Try running bundle update sqlite3
*
I don't know what that means or how to solve it.
Here's what's uncommented in my Gemfile:
gem 'rails', '3.0.4'
gem 'sqlite3'
It has many commented out, like:
( # gem 'nokogiri'
( # gem 'sqlite3-ruby', :require => 'sqlite3'
My Gemfile.lock has these, among others:
nokogiri (1.4.4.1-x86-mingw32)
sqlite3 (1.3.3-x86-mingw32)
But troubles...
I thought I could solve this by doing "sudo port install sqlite3", which completed. I also have done "bundle update sqlite3". This seemed to complete, but then led me to another error:
***You have requested: nokogiri ~> 1.4.2
The bundle currently has nokogiri locked at 1.4.4.1.
Try running bundle update nokogiri
***
When I do "bundle update nokogiri", it seems to fail and gives me the same error again. This is the step that I can't get through.
Among many things in my Gemfile.lock i do have these: nokogiri (1.4.4.1-x86-mingw32) sqlite3 (1.3.3-x86-mingw32)
And those are what seem to be causing the error. I tried changing to (~> 1.0.0.0) etc to see if a less specific number would work but nope.
I also tried this specific nokogiri installation: sudo port install libxml2 libxslt sudo gem install nokogiri
But even after this, I see this:
** Execute db:drop
rake aborted!
undefined method []' for nil:NilClass
/Users/Mike/Desktop/MikeFiles/betheduke2/BeTheDuke/**nokogiri**/ruby/1.9.1/gems/activerecord-3.0.4/lib/开发者_StackOverflow中文版active_record/railties/databases.rake:126:in
rescue in block (2 levels) in '
Not sure what this means.
I also installed MacPorts in order to be able to install sqlite3, using "sudo port install sqlite3" http://www.macports.org/install.php Unable to install sqlite3-ruby gem
This seemed to successfully go through an extensive sqlite3 installation, but now that this is all finished, and when I attempt rake db:migrate, I'm still getting the sequence of sqlite3 errors. Then I do the bundle install, seemingly a success, then I'm getting the same old nokogiri error on repeat until I stop.
I also see this forum, https://github.com/tenderlove/nokogiri/issues/387. This suggests it's a "bundler issue" or a "gem version inconsistency", but I'm not sure if that's the case, what I should do. Edit the Gemfile? Should I change that to the version that I have?
Strange thing is that in my "gem list", I have "sqlite3-ruby (1.2.5)" but not nokogiri. Then, when I close Terminal and re-open, and re-run "rake db:migrate", then it kicks off the sqlite3 error first, then when I run bundle install, then it goes back to the nokogiri error.
This stack post said maybe it's because there are too many versions of sqlite3 on my computer: Sqlite3 causing problems for bundle install and gem install
Here is what I have: $ which -a sqlite3 /opt/local/bin/sqlite3 /usr/bin/sqlite3
$ which -a gem /Users/Mike/.rvm/rubies/ruby-1.9.2-p136/bin/gem /Users/Mike/.rvm/bin/gem /usr/bin/gem
$ which -a ruby /Users/Mike/.rvm/rubies/ruby-1.9.2-p136/bin/ruby /Users/Mike/.rvm/bin/ruby /usr/bin/ruby
Do you think these duplicates are conflicting with each other? If so, what should I type to delete the right one?
Anyone know what to do? Is it a "gotcha" in the upgrade to Rails3? This has happened immediately after merging two git branches (one developed on the older Ruby/Rails2 combos, and the other developed in Ruby1.9.1/Rails3.0.4.) We got a lot of merge errors even though none of the older versions of the two had been touched (we think it's a line ending issue cross mac & pc platforms), but not sure. Maybe something about the merging & migration is impacting this gems?
Also, "How to install sqlite3" was helpful: Problem installing sqlite3-ruby!
I'm not actually answering this, just making there be an answer by copy+pasting the OPs own answer that he edited into his question:
Wow, Update, solved!! I added a line into the gemfiles to tell it the range for my mac version of nokogiri, like it says here: Make bundler use different gems for different platforms, if you search for Stefan. It appears crossing from windows to mac development was the culprit.
精彩评论