在设置Ruby on Rails时如何安装SQLite3? [英] How do I install SQLite3 while setting up Ruby on Rails?

查看:56
本文介绍了在设置Ruby on Rails时如何安装SQLite3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程新手,我正在尝试为Windows 10安装Ruby on Rails.

I'm new to programming and I'm trying to install Ruby on Rails for Windows 10.

我已经尝试过几次运行gem install bundler,但是SQLite3总是存在错误.

I've tried several times to run the gem install bundler but there's always an error for SQLite3.

命令提示符说要从 http://www.sqlite.org/安装SQLite3,但是我不知道将其放置在目录中的位置.

The command prompt says to install SQLite3 from http://www.sqlite.org/ but I don't know where to place it in the directory.

我看了 mkmf.log ,但我不明白它在告诉我什么.

I looked at the mkmf.log but I can't understand what it's telling me.

当我在RailsInstaller的"bin"文件夹中查找sql​​ite3.def时,出现了sqlite 3.dll sqlite3应用程序和sqlite3_ruby(文件和批处理文件).

When I look in RailsInstaller's 'bin' folder sqlite3.def, sqlite 3.dll sqlite3 application and sqlite3_ruby (file and batch file) are present.

如果有人知道可能出了什么问题以及如何解决它,我将非常感谢您的帮助,该问题永远不会在在线使用指南中发生.

If anyone knows what might be going wrong and how to fix it I'd really appreciate some help, this problem never happens on the online how-to guides.

非常感谢

命令提示符消息:

在安装sqlite3(1.4.0)时发生错误,并且Bundler无法继续.确保 gem安装sqlite3 -v'1.4.0'--source绑定之前,"https://rubygems.org/" 成功.

在Gemfile中:sqlite3

In Gemfile: sqlite3

C:\ Sites \ test_app> gem安装sqlite3 -v 1.4.0临时增强包含DevKit的路径...构建本机扩展.这可能需要一会儿...错误:安装sqlite3时出错:错误:无法生成gem本机扩展.

C:\Sites\test_app>gem install sqlite3 -v 1.4.0 Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension.

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3

C:/RailsInstaller/Ruby2.3.​​3/bin/ruby.exe -r./siteconf20190317-7152-n0tljg.rb extconf.rb正在检查sqlite3.h ...没有sqlite3.h丢失.从 http://www.sqlite.org/安装SQLite3第一的. * extconf.rb失败* 由于某种原因(可能缺少必需的库和/或头文件)而无法创建Makefile.查看有关更多详细信息,请参见mkmf.log文件.您可能需要配置选项.

C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190317-7152-n0tljg.rb extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

提供的配置选项:--with-opt-dir--without-opt-dir--with-opt-include--without-opt-include = $ {opt-dir}/include--with-opt-lib--without-opt-lib = $ {opt-dir}/lib--with-make-prog--with-make-prog--srcdir =.--curdir--ruby = C:/RailsInstaller/Ruby2.3.​​3/bin/$(RUBY_BASE_NAME)--with-sqlcipher--without-sqlcipher--with-sqlite3-config--without-sqlite3-config--with-pkg-config--without-pkg-config--with-sqlcipher--without-sqlcipher--with-sqlite3-dir--without-sqlite3-dir--with-sqlite3-include--without-sqlite3-include = $ {sqlite3-dir}/include--with-sqlite3-lib--without-sqlite3-lib = $ {sqlite3-dir}/lib

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME) --with-sqlcipher --without-sqlcipher --with-sqlite3-config --without-sqlite3-config --with-pkg-config --without-pkg-config --with-sqlcipher --without-sqlcipher --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib

要查看此扩展为何无法编译,请检查mkmf.log可以在这里找到:

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/RailsInstaller/Ruby2.3.​​3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log

C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log

extconf失败,退出代码1

extconf failed, exit code 1

宝石文件将继续安装在C:/RailsInstaller/Ruby2.3.​​3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for检查.结果记录到C:/RailsInstaller/Ruby2.3.​​3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.ou

Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for inspection. Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.ou

推荐答案

Rails尝试自动安装最新版本的sqlite3 gem(1.4),但该新版本尚不适用于Rails.指定一个像这样的版本:

Rails tries to automatically install the latest version of the sqlite3 gem (1.4), but that new version doesn’t work with Rails yet. Specify a version that works like this:

宝石文件

gem 'sqlite3', '< 1.4'

然后重新运行捆绑安装.

这篇关于在设置Ruby on Rails时如何安装SQLite3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆