I am newbie to ruby on rails i could not find the solution for this error:
rails s
/usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require': cannot load such file -- mysql2/mysql2 (LoadError)
from /usr/local/share/gems/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/Harish/Documents/simple_cms/config/application.rb:7:in `<top (required)>'
from /usr/local/share/gems/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/share/gems/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/share/gems/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/share/gems/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
gem uninstall mysql2
gem install mysql2 --platform=ruby
delete the mysql2 gem directory in your rails specific bundle directory and copy paste this newly install mysql2 gem
For Rails 3.2.17 and Ruby 1.9.3-p448 and mysql2 0.3.11, running bundle update mysql2 updated to 0.3.15 and got rid of the error for me.
Ya, It's happening with new version(0.3.13) of mysql2 gem with rails 4.0.0. Deleting the bundle folder under vendor directory, and rerunning bundle install, update fixed this issue for me
cd {Your_RailsApp_Root}/vendor/
rm -rf bundle/
cd {Your_RailsApp_Root}
bundle install
bundle update
Do you have the mysql2 gem installed? Check that your gemfile has gem "mysql2" and then run bundle install from the root of your rails app. Also, ensure that you mysql downloaded in your development environment.
just downgrade the mysql2 version. In my case, I used '0.2.6' version and it worked for me.
gem 'mysql2', '0.2.6'
with ruby version 2.0.0 and gem version 1.8.25
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
from
https://gorails.com/setup/osx/10.14-mojave
I battled this for a day when running into it while trying to run bundle exec rake db:migrate after successfully bundle installing my project gems.
For me, mysql2 was trying to load a configuration file that didn't exist. I had already brew installed mysql on my system, and what mysql2 was looking for existed already in the mysql installation. I ran
gem install mysql2 -v 0.5.3 -- --with-mysql-config=/usr/local/Cellar/mysql#5.6/5.6.42/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
to point mysql2 to the correct configuration.
NOTE the version you have of mysql may be different and the version of the gem you want may also be different.
ALSO NOTE: the gem install path may be different than your bundle install path. You can also the gem to your bundle directory with
gem install --install-dir /path/to/bundle/directory
OR you can set gem options with your bundle build configuration:
bundle config --local build.mysql2 --with-mysql-config="/usr/local/Cellar/mysql#5.6/5.6.42/bin/mysql_config" --with-ldflags=-"L/usr/local/opt/openssl/lib" --with-cppflags=-"I/usr/local/opt/openssl/include"
Apple silicon M1:
gem install mysql2 -v '0.5' -- --with-opt-dir=$(brew --prefix openssl)
It work for me.
gem uninstall mysql2
sudo gem install mysql2
bundle
this solved my error:
[root#localhost cms]# su Harish
[Harish#localhost cms]$ bundle install
[Harish#localhost cms]$ rails s
Related
When I try to setup basic installation and initiation of server using Rails 4.0.0 on Ruby 2.0.0, I'm facing the following error message.
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/penchal/new/site/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I avoid this error message and proceed further?
Find your sqlite3 gemspec file. One example is /usr/local/share/gem/specifications/sqlite3-1.3.7.gemspec
Windows:
C:\Ruby21\lib\ruby\gems\2.1.0\specifications.
You should adjust according with your Rubygem path and sqlite3 version.
Edit the file above and look for the following line
s.require_paths=["lib"]
change it to
s.require_paths= ["lib/sqlite3_native"]
Since pull request #229 has been merged, sqlite3 can be installed per git: key. It's possible to use sqlite3 easily through this addition in your Gemfile :
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
This works on RubyInstaller-2.4 and newer. It automatically installs the required pacman package mingw-w64-x86_64-sqlite3 when you run bundler install.
There are some more hints for Rails on Windows in the RubyInstaller2 FAQ.
see:https://stackoverflow.com/a/39136421/6755206
fortunately, you don't have to switch to ruby 2.0
there is a solution to this issue, after endless trying...
https://github.com/hwding/sqlite3-ruby-win
Steps
Pre
gem uninstall sqlite3 --all
Source
Download the latest sqlite3-ruby, https://github.com/sparklemotion/sqlite3-ruby
unzip the package
Build
run command-line in the extracted dir
make sure you have your C compiler installed and added to PATH
gem install bundler
bundle install
rake native gem
you'll find a dir named 'pkg' generated
Install
enter dir 'pkg'
gem install --local sqlite3-xxx.gem ('xxx' is version code)
Check
irb
require 'sqlite3'
gem uninstall sqlite3 --all
ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem inst sqlite3 --platform ruby
This solved the problem to me.
Windows 10
Ruby 2.5.3
Rails 5.2.2
Just edit Gemfile and add gem 'sqlite3', platform: :ruby.
No compiling of the sources or downloading pre-compiled libraries will solve this problem, believe me I tried everything, the problem lies somewhere else. This is how it works on windows:
bundle update sqlite3
You likely get another similar error after this one regarding nokogiri, fix it with the command:
bundle update nokogiri
Enjoy your Ruby App!
Uninstalling and reinstalling the sqlite3 gem worked for me.
gem uninstall sqlite3
bundle
If the top answer doesn't work, a fix that I discovered is simply going to your Gemfile and adding the version number 1.3.11 (instead of 1.3.9) right after sqlite3. So the line in your Gemfile should now read:
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '1.3.11'
This worked for me:
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
BEST OFFICIAL INSTALL
Im using rails 5.2.1p57, Windows 10
Just running following lines sloved the problem
gem uninstall sqlite3
and uninstall all installed versions. again execute following command
gem install sqlite3 --platform=ruby
You are now done.
Let me know if problem persist.
I had the same error when I upgrade my Ruby version to 2.5.X. I tracked with rails task --trace that the sqlite3 is not available to version 2.5, than I change my GemFile the gem "sqlite3" change to "sqlite3-ruby", after I uninstall the gem "sqlite3" and finally I run the bundle install.
I don't know what is the reason... I read that "sqlite3" is not available for ruby 2.5 yet, but I'm not sure.
To avoid this error, ensure that gem sqlite3 is added to your Gemfile.
Then extract "exe"s and "dll"s from Sqlite download link to Ruby's bin folder.
If problem still persists. Try this:
bundle update
gem uninstall sqlite3
Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here
Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3
.
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
>
y
gem install sqlite3 --platform=ruby
rails s
This should work.
Read through this link for more explanation if above works for you.
This happened to me as well. It turned out that I had originally installed SQLite 1.3.10, but then I copied some gems from the Rails tutorial screencasts project and it listed SQLite 1.3.9. Then I got the same error you did. I changed it back to 1.3.10 and it worked.
(This is on Windows 7. I was running the screencast tutorial on Cloud9 IDE).
This is the only solution worked for me, derived from this GitHub issue post:
Get autoconf version of sqlite3 sources from https://www.sqlite.org/download.html.
Start MSYS shell.
In unpacked location for your sqlite3, configure static version only to avoid keeping DLL on PATH: ./configure --disable-shared.
Build and install it: make install DESTDIR=/c/dev/ruby/tmp. You can change the directory.
Open command prompt of windows and run gem uninstall sqlite3 --all to remove all existing sqlite3 gems.
Again on command prompt of windows, build and install sqlite3 gem: gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:\dev\ruby\tmp\usr\local\include --with-sqlite3-lib=C:\dev\ruby\tmp\usr\local\lib. Those include and lib directories may be different, so check at first.
I am using Ruby version 2.5.1 and Rails version 5.2.0 on Windows 10.
i found it! i saw this https://www.youtube.com/watch?v=lsrzvX0qzmA
i instaled:
Rails version: 5.2.1
Ruby version: 2.5.3 (x64-mingw32)
Sqlite version 1.3.13
and i have your problem...
my solution:
In your installing folder like C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\
you have folders:
"sqlite3-1.3.13"
"sqlite3-1.3.13-x64-mingw32"
Find file
C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13\lib\sqlite3\sqlite3_native.so
Copy it in C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32\lib\sqlite3\2.5\sqlite3_native.so
(may be folders not exist - create and paste)
Updated
Adding the below to the Gemfile fixed for me:
gem 'sqlite3', '1.4.0', platforms: :ruby
Change your sqlite3 gem in the Gemfile for this:
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
Then run:
bundle install
For OSX users, this can result from using a ruby manager (e.g. rvm).
If you edit your ~/.bash_profile and add this:
[[ "$APP" = *"/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/"* ]] && {
echo Xcode detected
rvm use system
}
You can work around the issue. Restart Xcode before attempting to build again.
The actual issue is tracked here: https://openradar.appspot.com/28726736).
Full credit goes to: https://egeek.me/2018/04/14/ipa-export-error-in-xcode-and-ruby/
I had the same probe but its quite simple,
gem uninstall sqlite3 --all
then run
gem install sqlite3
everything should work well from there.
I tried:
sudo apt-get install sqlite3
Then I tried:
gem install sqlite3
And it worked
I have a lot of difficulties to run Ruby on Rails. Maybe you can tell me where I'm wrong ?
I'm on Linux Mint 17.2, with LAMP local server.
To install Ruby :
$ sudo apt-get install ruby
$ ruby -v
ruby 1.9.3p484
$
I didn't have to install gem, it works as shown here :
$ gem help commands
GEM commands are:
build Build a gem from a gemspec
cert Manage RubyGems certificates and signing settings
(...)
update Update the named gems (or all installed gems) in the local
repository
which Find the location of a library file you can require
For help on a particular command, use 'gem help COMMAND'.
Commands may be abbreviated, so long as they are unambiguous.
e.g. 'gem i rake' is short for 'gem install rake'.
Then I installed rails, I dont remember which of those two ways :
$ sudo gem install rails
or
$ sudo apt-get install ruby-railties-4.0
I dont find how to uninstall, so I can't test other ways to install.
Then, I made an application :
$ rails new (path)/second_app
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
(...)
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
/usr/lib/ruby/1.9.1/rubygems.rb:308:in `bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException)
from /var/lib/gems/1.9.1/gems/railties-4.0.2/lib/rails/generators/app_base.rb:268:in `bundle_command'
from /var/lib/gems/1.9.1/gems/railties-4.0.2/lib/rails/generators/app_base.rb:277:in `run_bundle'
from (eval):1:in `run_bundle'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands/application.rb:43:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/railties-4.0.2/lib/rails/cli.rb:15:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/railties-4.0.2/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
It looks like it was a problem running bundle install. According to tutorials, I run the command
$ bundle install
And I got
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.4.2)
Using i18n (0.7.0)
Using minitest (4.7.5)
…
Using jbuilder (1.5.3)
Using jquery-rails (3.1.3)
Installing json (1.8.3)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /home/alejandro/.bundler/tmp/9377/gems/json-1.8.3 for inspection.
Results logged to /home/alejandro/.bundler/tmp/9377/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
I tryed to install json in several ways :
$ sudo gem install json -v '1.8.3'
$ sudo apt-get install json -v '1.8.3'
$ sudo gem install json
But it don't work. I tryed to to run de server :
$ rails server
Could not find gem 'rails (= 4.0.2) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
I have tryed to install rvm and rbenv, but nothing works in the way tutorials says it should. My feeling is that I missed something in the begynning, but I dont know what.
Could you please help me ?
Thanks
Alex
You need to update gem lock and all dependency
For that please execute below command,
gem update --system
Now You can install json gem using ,
gem install json
Try above command and let me know if you still face same thing. Above things works fine for me:D
I'm new to Ruby on Rails and was following Lynda's Ruby on Rails essential training guide videos.
In the getting started set of videos, we are shown how the 'rails generator' command works. I have followed all the steps, but every time I type in '$ rails generate' I get the following error:
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/commands.rb:33:in `<module:Spring>'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/commands.rb:4:in `<top (required)>'
from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:77:in `preload'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/waleedrahamtullah/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
How do you suppose I get around this?
The answer is in the Error:
You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all`
Update with this:
gem install rubygems-update
Then run:
gem pristine --all
All should be well.
When I update
gem install rubygems-update
and then
gem pristine --all
it didn't work for me.
But answer from How to upgrade rubygems helped to fix issue, but after that for some reason I had to install rails again and install all gems.
Install rubygems-update
gem install rubygems-update
update_rubygems
gem update --system
run this commands as root or use sudo.
I am using ruby with rbenv so I could run those as normal user.
However, generating new rails site
rails new blog
Shows warning about old rubygems.
Warning: You're using Rubygems 2.0.14 with Spring.
Hmm. Checking the environment:
gem env
shows
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
which is no good. As suggested on the internets I run:
gem install rubygems-update
gem pristine --all
update_rubygems
I am not sure if gem pristine --all was needed, but it can't harm anything. Checking the update status now
gem env
shows
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
which is good. Calling
rails new blog
and everything went ok. No warning at all.
When I try to setup basic installation and initiation of server using Rails 4.0.0 on Ruby 2.0.0, I'm facing the following error message.
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/penchal/new/site/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I avoid this error message and proceed further?
Find your sqlite3 gemspec file. One example is /usr/local/share/gem/specifications/sqlite3-1.3.7.gemspec
Windows:
C:\Ruby21\lib\ruby\gems\2.1.0\specifications.
You should adjust according with your Rubygem path and sqlite3 version.
Edit the file above and look for the following line
s.require_paths=["lib"]
change it to
s.require_paths= ["lib/sqlite3_native"]
Since pull request #229 has been merged, sqlite3 can be installed per git: key. It's possible to use sqlite3 easily through this addition in your Gemfile :
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
This works on RubyInstaller-2.4 and newer. It automatically installs the required pacman package mingw-w64-x86_64-sqlite3 when you run bundler install.
There are some more hints for Rails on Windows in the RubyInstaller2 FAQ.
see:https://stackoverflow.com/a/39136421/6755206
fortunately, you don't have to switch to ruby 2.0
there is a solution to this issue, after endless trying...
https://github.com/hwding/sqlite3-ruby-win
Steps
Pre
gem uninstall sqlite3 --all
Source
Download the latest sqlite3-ruby, https://github.com/sparklemotion/sqlite3-ruby
unzip the package
Build
run command-line in the extracted dir
make sure you have your C compiler installed and added to PATH
gem install bundler
bundle install
rake native gem
you'll find a dir named 'pkg' generated
Install
enter dir 'pkg'
gem install --local sqlite3-xxx.gem ('xxx' is version code)
Check
irb
require 'sqlite3'
gem uninstall sqlite3 --all
ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem inst sqlite3 --platform ruby
This solved the problem to me.
Windows 10
Ruby 2.5.3
Rails 5.2.2
Just edit Gemfile and add gem 'sqlite3', platform: :ruby.
No compiling of the sources or downloading pre-compiled libraries will solve this problem, believe me I tried everything, the problem lies somewhere else. This is how it works on windows:
bundle update sqlite3
You likely get another similar error after this one regarding nokogiri, fix it with the command:
bundle update nokogiri
Enjoy your Ruby App!
Uninstalling and reinstalling the sqlite3 gem worked for me.
gem uninstall sqlite3
bundle
If the top answer doesn't work, a fix that I discovered is simply going to your Gemfile and adding the version number 1.3.11 (instead of 1.3.9) right after sqlite3. So the line in your Gemfile should now read:
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '1.3.11'
This worked for me:
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
BEST OFFICIAL INSTALL
Im using rails 5.2.1p57, Windows 10
Just running following lines sloved the problem
gem uninstall sqlite3
and uninstall all installed versions. again execute following command
gem install sqlite3 --platform=ruby
You are now done.
Let me know if problem persist.
I had the same error when I upgrade my Ruby version to 2.5.X. I tracked with rails task --trace that the sqlite3 is not available to version 2.5, than I change my GemFile the gem "sqlite3" change to "sqlite3-ruby", after I uninstall the gem "sqlite3" and finally I run the bundle install.
I don't know what is the reason... I read that "sqlite3" is not available for ruby 2.5 yet, but I'm not sure.
To avoid this error, ensure that gem sqlite3 is added to your Gemfile.
Then extract "exe"s and "dll"s from Sqlite download link to Ruby's bin folder.
If problem still persists. Try this:
bundle update
gem uninstall sqlite3
Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here
Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3
.
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
>
y
gem install sqlite3 --platform=ruby
rails s
This should work.
Read through this link for more explanation if above works for you.
This happened to me as well. It turned out that I had originally installed SQLite 1.3.10, but then I copied some gems from the Rails tutorial screencasts project and it listed SQLite 1.3.9. Then I got the same error you did. I changed it back to 1.3.10 and it worked.
(This is on Windows 7. I was running the screencast tutorial on Cloud9 IDE).
This is the only solution worked for me, derived from this GitHub issue post:
Get autoconf version of sqlite3 sources from https://www.sqlite.org/download.html.
Start MSYS shell.
In unpacked location for your sqlite3, configure static version only to avoid keeping DLL on PATH: ./configure --disable-shared.
Build and install it: make install DESTDIR=/c/dev/ruby/tmp. You can change the directory.
Open command prompt of windows and run gem uninstall sqlite3 --all to remove all existing sqlite3 gems.
Again on command prompt of windows, build and install sqlite3 gem: gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:\dev\ruby\tmp\usr\local\include --with-sqlite3-lib=C:\dev\ruby\tmp\usr\local\lib. Those include and lib directories may be different, so check at first.
I am using Ruby version 2.5.1 and Rails version 5.2.0 on Windows 10.
i found it! i saw this https://www.youtube.com/watch?v=lsrzvX0qzmA
i instaled:
Rails version: 5.2.1
Ruby version: 2.5.3 (x64-mingw32)
Sqlite version 1.3.13
and i have your problem...
my solution:
In your installing folder like C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\
you have folders:
"sqlite3-1.3.13"
"sqlite3-1.3.13-x64-mingw32"
Find file
C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13\lib\sqlite3\sqlite3_native.so
Copy it in C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32\lib\sqlite3\2.5\sqlite3_native.so
(may be folders not exist - create and paste)
Updated
Adding the below to the Gemfile fixed for me:
gem 'sqlite3', '1.4.0', platforms: :ruby
Change your sqlite3 gem in the Gemfile for this:
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
Then run:
bundle install
For OSX users, this can result from using a ruby manager (e.g. rvm).
If you edit your ~/.bash_profile and add this:
[[ "$APP" = *"/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/"* ]] && {
echo Xcode detected
rvm use system
}
You can work around the issue. Restart Xcode before attempting to build again.
The actual issue is tracked here: https://openradar.appspot.com/28726736).
Full credit goes to: https://egeek.me/2018/04/14/ipa-export-error-in-xcode-and-ruby/
I had the same probe but its quite simple,
gem uninstall sqlite3 --all
then run
gem install sqlite3
everything should work well from there.
I tried:
sudo apt-get install sqlite3
Then I tried:
gem install sqlite3
And it worked
I was trying to install Redmine on Fedora 17, following this
Until this step:
RAILS_ENV=production rake db:migrate
It throws an error saying:
rake aborted!
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (cannot load such file -- mysql2/mysql2)
/var/www/redmine/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>'
/var/www/redmine/config/initializers/00-core_plugins.rb:12:in `eval'
/var/www/redmine/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
/var/www/redmine/config/initializers/00-core_plugins.rb:2:in `each'
/var/www/redmine/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
/var/www/redmine/config/environment.rb:14:in `<top (required)>'
Tasks: TOP => db:migrate => environment
which is weird, because I have already installed mysql2 with bundle:
bundle show
...
* mysql2 (0.3.11)//***which is right in the bundle show list***
...
my database.yml is like:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: 123456
encoding: utf8
others my be involved
ruby 1.9.3p327 (2012-11-10 revision 37606) [i386-linux]
Rails 3.2.8
gem 1.8.24
mysql Ver 14.14 Distrib 5.5.28, for Linux (i686) using readline 5.1
Redmine 2.1.3
I have found some related questions by google, like:http://www.redmine.org/issues/11071#note-4
And I do as they said, adding symlink
ln -s /usr/local/share/gems/gems/mysql2-0.3.11/lib /usr/share/ruby/mysql2
Then exactly as posted in the page:
rake aborted!
uninitialized constant Mysql2::Client::REMEMBER_OPTIONS
I tried to do what is posted in #6 but it didn't work for me.
Is this the right way to solve my problem, and what should I do with the second bug.
Add gem 'mysql2' in your gemfile and run bundle install and then do RAILS_ENV=production rake db:migrate
If you're using Fedora's ruby, try:
yum install ruby-mysql
If you're using RVM or any other similar tool, install mysql's development packages, and then reinstall the ruby mysql gem.
yum install mysql-devel
> add gem "minitest" into Gemfile
> gem list | cut -d" " -f1 | xargs gem uninstall -aIx
> yum erase rubygem-activesupport-3.0.11-5.fc17.noarch
> yum install rubygem-bundler
> bundle install
> then other steps, this works!!
for details, please refer to this
thanks!!