0

我正在尝试创建一个新的 Ruby On Rails 项目。我正在关注官方的 Rails 入门指南。运行 Ruby 2.2 的Rails 安装程序后,我尝试通过运行创建一个新项目rails new blog并收到以下错误:

...
Installing sqlite3 1.4.0 with native extensions
Installing turbolinks-source 5.2.0
Installing i18n 1.6.0
Installing tzinfo 1.2.5
Installing nokogiri 1.10.2
Using rack-test 0.6.3
Installing sprockets 3.7.2
Installing websocket-driver 0.6.5 with native extensions
Installing mail 2.7.1
Using coffee-script 2.4.1
Installing uglifier 4.1.20
Installing rb-inotify 0.10.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r
./siteconf20190406-3720-ldo4eg.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.2.0/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

extconf failed, exit code 1

Gem files will remain installed in
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.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.

这个问题网上有很多“解决方案”。他们都解释了手动安装 sqlite 的不同方法。我曾尝试手动安装 sqlite,但不知道如何安装它,以便 Rails 知道在哪里可以找到我的本地安装。网上有很多关于如何做到这一点的不同建议,但没有一个对我有用。

我花了六个多小时试图简单地创建一个新的 Rails 项目并不断收到此错误(或类似错误)。据我了解,Rails 安装程序应该安装您开始所需的一切。我究竟做错了什么?

4

0 回答 0