首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为用于windows10的rails安装windows10

如何为用于windows10的rails安装windows10
EN

Stack Overflow用户
提问于 2019-02-22 10:54:46
回答 3查看 1.6K关注 0票数 0

当我调用rails来构建一个新应用程序的框架(即rails 5.1.3新的flix )时,我得到了错误,即命令输出的最后一部分是

代码语言:javascript
复制
Gem::Ext::BuildError: 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 ./siteconf20190222-12524-hspyoq.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.

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

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

extconf failed, exit code 1

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.out

An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0'` succeeds before bundling.

In Gemfile:
  sqlite3

当我运行gem install sqlite3 -v '1.4.0'时,我得到以下错误消息

代码语言:javascript
复制
C:\Users\acer>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 ./siteconf20190222-11816-8sfvgr.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.

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

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

extconf failed, exit code 1

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.out

如果有人在windows 10中安装了sqlite,请指导我。

提前谢谢。

EN

回答 3

Stack Overflow用户

发布于 2019-02-22 15:26:56

正如错误消息中所写的,您需要先在计算机上安装SQLite 3 (http://www.sqlite.org/)。红宝石sqlite3只提供了一种使用SQLite 3的方法,但是它仍然需要安装在您的系统上。

票数 1
EN

Stack Overflow用户

发布于 2019-04-10 13:46:57

我刚刚安装了我的红宝石轨道,今天是2019年4月10日。我花时间写了这个

当我尝试使用rails应用程序工作目录时,也遇到了同样的问题。

下面是我遵循的步骤,它运行得很好,没有任何错误。

1.)从链接下载Ruby,我下载了Ruby+Devkit 2.6.1-1 (x86),因为我使用的是window 32位。

运行安装文件

(2.)通过评估其版本来检查红宝石是否已安装

在命令提示符处键入

代码语言:javascript
复制
ruby -v

你将看到输出。Ruby2.6.1p33

3安装Rails

在命令提示符下运行

代码语言:javascript
复制
gem install rails

( 4.)若要检查安装的铁路版本,请执行。在命令提示符下运行

代码语言:javascript
复制
rails -v

你将看到输出。rails 5.2.3

)创建应用程序目录(如rails项目)。Cd C:>到任意目录位置并键入

代码语言:javascript
复制
rails new myRailsApp

如果一切正常,这将在c:/目录中创建myRailsApp

在您的例子中,它将在这一点上工作,这就是为什么它显示了上面的错误。

注:

但是请记住,您的应用程序工作目录**(MyRailsApp)**是创建的,尽管您在上面发布的错误是由sqlite3造成的。

此时,打开应用程序目录,并在命令propmt处键入下面的代码,以更新丢失的gem文件。

代码语言:javascript
复制
C:\myRailsApp>ridk exec pacman -S mingw-w64-x86_64-dlfcn

按enter键,它将被安装。

现在,在根目录下打开一个名为GemFile的文件。C:\myRailsApp

这条线变了

代码语言:javascript
复制
gem 'sqlite3'

到下面并保存

代码语言:javascript
复制
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

这里的解决方案是基于Larskanis逼近

然后在

代码语言:javascript
复制
C:\myRailsApp>bundle install

您的应用程序将编译没有任何错误。

若要测试ruby是否正在运行,请在项目目录下使用命令rails server启动服务器。

代码语言:javascript
复制
C:\myRailsApp>rails server

或者您也可以通过导航到bin目录来启动它。

代码语言:javascript
复制
C:\myRailsApp\bin>rails server

打开浏览器在http://localhost:3000和中提琴!

票数 1
EN

Stack Overflow用户

发布于 2019-09-04 22:49:51

我用以下命令解决了这个问题:

gem安装sqlite3 ver1.4.0-源代码“https://rubygems.org/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54825550

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档