当前位置: 首页 > 知识库问答 >
问题:

使用rails服务器启动服务器时出错,sqllite错误

云远
2023-03-14

我刚刚安装了Ruby193和Ruby200,在创建了一个新的应用程序之后,我正在尝试加载服务器,但是我得到了下面的错误。

=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/rubygems_integ
ration.rb:214:in `block in replace_gem': Please install the sqlite3 adapter: `ge
m install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add
it to Gemfile.) (LoadError)
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/dependencies.rb:251:in `require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/dependencies.rb:251:in `block in require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/dependencies.rb:236:in `load_dependency'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/dependencies.rb:251:in `require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/connection_adapters/abstract/connection_specification.rb:50:in `resol
ve_hash_connection'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/connection_adapters/abstract/connection_specification.rb:41:in `resol
ve_string_connection'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'

    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/connection_adapters/abstract/connection_specification.rb:130:in `esta
blish_connection'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/lazy_load_hooks.rb:36:in `instance_eval'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/lazy_load_hooks.rb:36:in `execute_hook'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/lazy_load_hooks.rb:42:in `each'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/ac
tive_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/base.rb:720:in `<top (required)>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/act
ive_record/railtie.rb:88:in `block in <class:Railtie>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/i
nitializable.rb:30:in `instance_exec'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/i
nitializable.rb:30:in `run'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/i
nitializable.rb:55:in `block in run_initializers'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/i
nitializable.rb:54:in `each'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/i
nitializable.rb:54:in `run_initializers'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/a
pplication.rb:136:in `initialize!'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/r
ailtie/configurable.rb:30:in `method_missing'
    from C:/Workspace/RailsTest/app_name/config/environment.rb:5:in `<top (r
equired)>'
    from C:/Workspace/RailsTest/app_name/config.ru:3:in `require'
    from C:/Workspace/RailsTest/app_name/config.ru:3:in `block in <main>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder
.rb:51:in `instance_eval'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder
.rb:51:in `initialize'
    from C:/Workspace/RailsTest/app_name/config.ru:in `new'
    from C:/Workspace/RailsTest/app_name/config.ru:in `<main>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder
.rb:40:in `eval'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder
.rb:40:in `parse_file'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/server.
rb:200:in `app'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/c
ommands/server.rb:46:in `app'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/server.
rb:304:in `wrapped_app'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/server.
rb:254:in `start'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/c
ommands/server.rb:70:in `start'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/c
ommands.rb:55:in `block in <top (required)>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/c
ommands.rb:50:in `tap'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/c
ommands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我用gem'sqlite3'替换了sqlite3 gem,'~

ERROR:  Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any
repository
ERROR:  Possible alternatives: activerecord-jdbcsqlite3-adapter, activerecord-sq
lserver-adapter, activerecord-bq-adapter, activerecord-simpledb-adapter, activer
ecord-mysql2-adapter

有人知道怎么修吗?

Gemfile是

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3', '~> 1.3.0'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

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

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

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

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

Bundle Show提供捆绑包中包含的宝石:

  • actionmailer(3.2.13)
  • actionpack(3.2.13)
  • activemodel(3.2.13)
  • activerecord(3.2.13)
  • activeresource(3.2.13)
  • activesupport(3.2.13)
  • arel(3.0.2)
  • 建筑商(3.0.4)
  • 捆扎机(1.3.5)
  • 咖啡架(3.2.2)
  • 咖啡脚本(2.2.0)
  • coffee脚本源代码(1.6.2)
  • erubis(2.7.0)
  • execjs(1.4.0)
  • 徒步旅行(1.2.2)
  • i18n(0.6.1)
  • 旅程(1.0.4)
  • jquery rails(2.2.1)
  • json(1.7.7)
  • 邮件(2.5.3)
  • mime类型(1.23)
  • 多功能json(1.7.3)
  • polyglot(0.3.3)
  • 机架(1.4.5)
  • 机架缓存(1.2)
  • 机架ssl(1.3.3)
  • 机架测试(0.6.2)
  • 轨道(3.2.13)
  • 铁路(3.2.13)
  • 耙(10.0.4)
  • rdoc(3.12.2)
  • sass(3.2.9)
  • sass导轨(3.2.6)
  • 链轮(2.2.2)
  • 雷神(0.18.1)
  • 倾斜(1.4.1)
  • 树梢(1.4.12)
  • tzinfo(0.3.37)
  • 丑八怪(2.1.0)

Database.yml档案

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

共有1个答案

郏经纬
2023-03-14

这就是我解决问题的方法。

我使用rails安装程序重新安装了rails、ruby和devkit。现在效果很好。

 类似资料:
  • 我是RubyonRails的新手,这里我尝试在64位Windows7上安装RubyonRails。 运行命令后,我执行了,然后执行。但随后我在命令提示符下出错了。 如何解决此错误? 如果我运行bundle安装,我将

  • 问题内容: 我刚刚完成了重新安装操作系统的工作,并且像往常一样安装和测试了我使用的标准工具,现在当我尝试从eclipse启动Jboss 5时,出现了前所未有的错误: 以前有没有人遇到过类似的问题?到目前为止我从未遇到过 问题答案: 看起来像是JRE和OS版本的某些特定组合发生的错误(请参阅https://jira.jboss.org/jira/browse/JBAS-6981)。基本上,JBoss

  • 我是NodeJS的新手: 我写了server.js文件,我安装了NodeJS。当我运行时,我遇到以下错误。 C:\users\server\server.js:43 if(!(req.headers&req.headers.authorization)){ npm错误!argv“C:\Program Files\nodejs\\node.exe”“C:\Program Files\nodejs\n

  • 我最近开始从事一个从github克隆的项目。 每次尝试启动rails服务器时,都会出现以下错误: 我的同事也在做这个项目,启动服务器似乎没有任何问题。他正在运行和我一样版本的ruby,rails和WeBrick。 我已尝试将语法从key:更改为:key= 我已经厌倦了多次完全移除和重新安装rvm、ruby和rails,但都没有成功。我也尝试过运行bundle安装,但没有任何帮助。 有人知道出了什么

  • 在启动节点管理器之后,当我要启动startWeblogic时。sh发生这种情况时,服务器无法启动。(用户名、密码正确) 以行开始WLS:home/app/oracle/java/jdk1.8.0_171/bin/java-server-Xms256m-Xmx512m-XX:CompileThreshold=8000-cp/home/12c/app/oracle/product/12.2.1/wls

  • 我已经在系统上安装并配置了ATG。我对发布服务器和生产服务器使用以下配置: 出版 HTTP端口:8180 HTTPS端口:8543 站点HTTP端口:8180 RMI端口:8861 DRP端口:8851 文件部署:8811 生产 HTTP端口:8080 HTTPS端口:8443 站点HTTP端口:8080 RMI端口:8860 DRP端口:8850 文件部署:8810 在运行我的生产服务器的之后,