ruby-on-rails – Sqlite3 gem未加载,gem安装并在项目中指定

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Sqlite3 gem未加载,gem安装并在项目中指定前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
因此,在我寻求使用 ruby dev环境的过程中,我遇到了一个似乎……让这个ruby菜鸟感到困惑的问题.

执行rails服务器时,它会按预期启动,但是当您将localhost:3000放入标准Web浏览器时,它会回复以下内容

Specified ‘sqlite3’ for database adapter,but the gem is not loaded. Add gem 'sqlite3' to your Gemfile.

现在这里是令人困惑的部分.我安装了sqlite3(64位版本,因为这是我下载的,运行的是64位操作系统),由gem查询验证(这里是宝石的完整列表)

卸载和重新安装并不能解决手头的问题,但它确实安装顺利.另外我正在测试的项目的gemfile是folliwing

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','4.0.0'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails','~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier','>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails','~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder','~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc',require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby','~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano',group: :development

# Use debugger
# gem 'debugger',group: [:development,:test]

正如你所看到的,很早就在Gemfile中指定了sqlite3,但是当我尝试加载主页时,无论出于何种原因,它就像它不存在一样.

此机器的详细信息如下所述:宝石部分中未提及:

Rails 4
Ruby 2
Windows 7的

以前有人遇到过这个吗?

解决方法

我也有这个问题.进入你的Gemfile.lock文件搜索sqlite3’条目.你会注意到它读取sqlite3(1.3.8-x86-mingw32). 将其更改为sqlite3(1.3.8-x64-mingw32),然后运行bundle install命令,一切都应该正常工作.
原文链接:https://www.f2er.com/ruby/271137.html

猜你在找的Ruby相关文章