这个问题不重复。
我是一名新手,尝试使用https://www.railstutorial.org/book/beginning上的教程学习Ruby on rails。我已经完成了1.3.2之前的各个步骤,但是当我运行" rails服务器"命令我收到以下错误。根据我读过的一些评论,似乎我需要对sqlite做一个相对要求,因为Ruby已经从加载路径中删除了当前目录。使用require_relative。
我的GemFile如下:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
" Path" "系统变量"在我的Windows笔记本电脑上(为简洁起见):
C:\Ruby21\bin;C:\RailsInstaller\Ruby2.1.0\lib\ruby\gems\2.1.0\gems\sqlite3-1.3.9-x86-mingw32\lib\sqlite3\2.0;
C:\ RailsInstaller \ Ruby2.1.0 \ lib \ ruby \ gems \ 2.1.0 \ specifications \ sqlite3-1.3.9-x86-mingw32.gemspec具有以下行:
s.require_paths = ["lib/sqlite3_native"]
我在C:\ RailsInstaller \ Ruby2.1.0 \ lib \ ruby \ gems \ 2.1.0 \ specifications文件夹中有以下sqlite3 gemspec文件。
sqlite3-1.3.9-x86-mingw32.gemspec
sqlite3-1.3.10-x86-mingw32.gemspec
sqlite3-1.3.11-x86-mingw32.gemspec
我应该怎么做呢?
C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) from C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>' from C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from c:/Dashboard/Rails/hello_app/config/application.rb:7:in `<top (required)>'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'