这可能是一个新手设置问题。 但是这里…
机器设置
我有一个Windows 7 64位机运行轨4.0.0和ruby2.0.0我有以下在我的path
C:\Ruby200-x64\bin;C:\RubyDevKit\bin;C:\RubyDevKit\mingw\bin;
项目设置
我正在从一个同事的工作仓库克隆git项目。
当我运行我的初始
rake db:migrate
我得到以下错误
rake aborted! Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's qlite3'` to your Gemfile. C:/Working/mynewproject/config/environment.rb:5:in `<top (required)>' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)
我的Gemfile包含gem'sqlite3',如下所示
# Use sqlite3 as the database for Active Record gem 'sqlite3'
完整的Gemfile是
source 'https://rubygems.org' ruby '2.0.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' gem 'rails_12factor', group: :production # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.0' # Use Twitter Bootstrap for styling gem 'bootstrap-sass' # 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] gem 'protected_attributes' # should probably use strong parameters!
当我运行bundle install
我得到以下列表 – 注意sqlite3的缺席
Using rake (10.1.0) Using i18n (0.6.5) Using minitest (4.7.5) Using multi_json (1.7.9) Using atomic (1.1.13) Using thread_safe (0.1.2) Using tzinfo (0.3.37) Using activesupport (4.0.0) Using builder (3.1.4) Using erubis (2.7.0) Using rack (1.5.2) Using rack-test (0.6.2) Using actionpack (4.0.0) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (4.0.0) Using activemodel (4.0.0) Using activerecord-deprecated_finders (1.0.3) Using arel (4.0.0) Using activerecord (4.0.0) Using sass (3.2.10) Using bootstrap-sass (2.3.2.2) Using coffee-script-source (1.6.3) Using execjs (2.0.1) Using coffee-script (2.2.0) Using thor (0.18.1) Using railties (4.0.0) Using coffee-rails (4.0.0) Using hike (1.2.3) Using jbuilder (1.5.1) Using jquery-rails (3.0.4) Using json (1.8.0) Using protected_attributes (1.0.3) Using bundler (1.3.5) Using tilt (1.4.1) Using sprockets (2.10.0) Using sprockets-rails (2.0.0) Using rails (4.0.0) Using rails_serve_static_assets (0.0.1) Using rails_stdout_logging (0.0.2) Using rails_12factor (0.0.2) Using rdoc (3.12.2) Using sass-rails (4.0.0) Using sdoc (0.3.20) Using turbolinks (1.3.0) Using uglifier (2.2.1) Your bundle is complete!
当我做bundle show 'sqlite3'
我得到
Could not find gem 'sqlite3'. Did you mean sqlite3?
当我做gem install 'sqlite3'
我得到
Successfully installed sqlite3-1.3.8-x64-mingw32 Parsing documentation for sqlite3-1.3.8-x64-mingw32 unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/2.0/sqlite3_native.so, skipping 1 gem installed
经过查找有关“无法转换”的错误,我发现我可以安装没有文档。 所以,如果我这样做
gem install 'sqlite3' --no-doc
我明白了
Successfully installed sqlite3-1.3.8-x64-mingw32 1 gem installed
然后当我这样做
rake db:migrate
我仍然得到
rake aborted! Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's qlite3'` to your Gemfile. C:/Working/mynewproject/config/environment.rb:5:in `<top (required)>' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)
那么,我错过了什么?
谢谢
在评论中提出build议之后更新:
由于Doon的评论,我把gemfile的内容放在了上面问题的描述中
为了回应techvineet的评论,我已经用一致的输出来执行bundle install
几次了。
由于zrl3dx的评论,我现在已经运行了bundle exec bundle
并获得相同的输出,即
Using rake (10.1.0) Using i18n (0.6.5) Using minitest (4.7.5) Using multi_json (1.7.9) Using atomic (1.1.13) Using thread_safe (0.1.2) Using tzinfo (0.3.37) Using activesupport (4.0.0) Using builder (3.1.4) Using erubis (2.7.0) Using rack (1.5.2) Using rack-test (0.6.2) Using actionpack (4.0.0) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (4.0.0) Using activemodel (4.0.0) Using activerecord-deprecated_finders (1.0.3) Using arel (4.0.0) Using activerecord (4.0.0) Using sass (3.2.10) Using bootstrap-sass (2.3.2.2) Using coffee-script-source (1.6.3) Using execjs (2.0.1) Using coffee-script (2.2.0) Using thor (0.18.1) Using railties (4.0.0) Using coffee-rails (4.0.0) Using hike (1.2.3) Using jbuilder (1.5.1) Using jquery-rails (3.0.4) Using json (1.8.0) Using protected_attributes (1.0.3) Using bundler (1.3.5) Using tilt (1.4.1) Using sprockets (2.10.0) Using sprockets-rails (2.0.0) Using rails (4.0.0) Using rails_serve_static_assets (0.0.1) Using rails_stdout_logging (0.0.2) Using rails_12factor (0.0.2) Using rdoc (3.12.2) Using sass-rails (4.0.0) Using sdoc (0.3.20) Using turbolinks (1.3.0) Using uglifier (2.2.1) Your bundle is complete!
由于Sachin Singh的评论,我删除了Gemfile.lock并运行bundle install
。 结果几乎相同:
Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/.. Resolving dependencies... Using rake (10.1.0) Using i18n (0.6.5) Using minitest (4.7.5) Using multi_json (1.7.9) Using atomic (1.1.13) Using thread_safe (0.1.2) Using tzinfo (0.3.37) Using activesupport (4.0.0) Using builder (3.1.4) Using erubis (2.7.0) Using rack (1.5.2) Using rack-test (0.6.2) Using actionpack (4.0.0) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (4.0.0) Using activemodel (4.0.0) Using activerecord-deprecated_finders (1.0.3) Using arel (4.0.0) Using activerecord (4.0.0) Using sass (3.2.10) Using bootstrap-sass (2.3.2.2) Using bundler (1.3.5) Using coffee-script-source (1.6.3) Using execjs (2.0.1) Using coffee-script (2.2.0) Using thor (0.18.1) Using railties (4.0.0) Using coffee-rails (4.0.0) Using hike (1.2.3) Using jbuilder (1.5.1) Using jquery-rails (3.0.4) Using json (1.8.0) Using protected_attributes (1.0.3) Using tilt (1.4.1) Using sprockets (2.10.0) Using sprockets-rails (2.0.0) Using rails (4.0.0) Using rails_serve_static_assets (0.0.1) Using rails_stdout_logging (0.0.2) Using rails_12factor (0.0.2) Using rdoc (3.12.2) Using sass-rails (4.0.0) Using sdoc (0.3.20) Using turbolinks (1.3.0) Using uglifier (2.2.1) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
所以仍然没有提到sqlite3和rake db:migrate
仍然结果
rake aborted! Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's qlite3'` to your Gemfile. C:/Working/its-a-disaster/config/environment.rb:5:in `<top (required)>' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)
为了回应Sachin Singh的问题, ruby -v command
的输出是什么?
它说:
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
和rails – 版本说
Rails 4.0.0
Prusswan问,在同一台机器上还有其他的ruby安装吗?
有三个 – 1.9.2,1.9.3和2.0.0后者是path中的一个。 另外两个我已经删除。
Bundler和x64-mingw32
Ruby有一个已知的问题,它没有检测到x64-mingw32
gem平台,因此导致失败。
我相信这已经在1.4.0预发布版本中得到了修复,您可以通过下面的方法来尝试:
gem update bundler --pre bundle install
还有其他的问题,你可能会遇到的64位版本。 以下是我个人的建议:
除非你真的被迫使用超过2GB内存的应用程序(很可能不是Rails应用程序),否则我建议你使用Ruby的32位版本(以及相应的DevKit)
虽然你有一个64位版本的Windows,但是系统却能够正常运行32位应用程序。 使用Rails开发Web应用程序时,性能不会下降。
尽管Ruby 2.0.0已经被标记为稳定且可以生产,但是并不是所有的宝石和相关工具都已经更新,可以正常使用。 还有一些粗糙的方面需要解决,比如Bundler和64位Ruby。 作为大多数开源软件,这是一个社区的努力,可能需要帮助。
希望这可以帮助。