繁体   English   中英

安装sqlite3(1.3.11)时出错,Bundler无法继续

[英]An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue

所以我试图$ bundle install --without production在我$ git push heroku master但我一直收到这个错误

$ bundle install --without production
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies......
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.5
Using rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.99
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using execjs 2.6.0
Using autoprefixer-rails 6.1.2
Using sass 3.2.19
Using bootstrap-sass 3.3.5
Using bundler 1.10.6
Using coffee-script-source 1.10.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.11.2
Using jbuilder 2.3.2
Using jquery-rails 3.1.4
Using tilt 1.4.1
Using sprockets 2.12.4
Using sprockets-rails 2.3.3
Using rails 4.1.8
Using rdoc 4.2.0
Using sass-rails 4.0.5
Using sdoc 0.4.1
Installing sqlite3 1.3.11 with native extensions
C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39: warning: Tempfile#unlink or delete called on open file; ignoring

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    C:/jruby-9.0.0.0/bin/jruby.exe -r ./siteconf20151208-25620-qipdd0.rb extconf.rb
NotImplementedError: C extensions are not supported
    <top> at C:/jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
  require at org/jruby/RubyKernel.java:940
   (root) at C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
    <top> at extconf.rb:3

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.0.0.0/lib/ruby/gems/shared/gems/sqlite3-1.3.11 for inspection.
Results logged to C:/jruby-9.0.0.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.2.0/sqlite3-1.3.11/gem_make.out
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.

这是我的 Gemfile

source 'https://rubygems.org'

gem 'rails', '4.1.8'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'bootstrap-sass'



group :development, :test do
 gem 'sqlite3'
end

group :production do
 gem 'pg'
 gem 'rails_12factor'
end

group :doc do
    gem 'sdoc', require: false
end

我试过了

gem uninstall sqlite3
gem install sqlite

但我得到了

$ gem install sqlite3
Building native extensions.  This could take a while...
C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:39: warning: Tempfile#unlink or delete called on open file; ignoring
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    C:/jruby-9.0.0.0/bin/jruby.exe -r ./siteconf20151208-19428-iytd2g.rb extconf.rb
NotImplementedError: C extensions are not supported
    <top> at C:/jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
  require at org/jruby/RubyKernel.java:940
   (root) at C:/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
    <top> at extconf.rb:3

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.0.0.0/lib/ruby/gems/shared/gems/sqlite3-1.3.11 for inspection.
Results logged to C:/jruby-9.0.0.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.2.0/sqlite3-1.3.11/gem_make.out

有没有人对可能导致这种情况的原因有任何想法?

我认为您需要先安装 sqlite3 和 sqlite3-dev。

sudo apt-get install -y sqlite3 libsqlite3-dev

试试看,或许能解决你的问题

这可能会有所帮助。 我也有同样的问题。 我搜索了很多,我解决了它。 这可能只是关于 sqlite3 的版本。

你应该先这样做

sudo apt-get install -y sqlite3 libsqlite3-dev

然后打开你的 Gemfile 并将 sqlite3 的行更改为

gem 'sqlite3', '~> 1.3', '>= 1.3.11'

然后运行

bundle install

正如本杰明所说,您需要先安装 sqlite3 数据库,然后才能安装 sqlite3 gem。 看起来您使用的是 Windows,因此请尝试按照此处列出的说明进行操作:

如何在 Windows 上为 Ruby 安装 sqlite3?

作为参考,这是用户 Williams 在该线程上接受的答案:

  1. 为您的设置安装 Ruby Devkit(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe 因为我使用的是 x64 机器)

  2. 从 Sqlite.org 下载并解压 autoconf 包

  3. 运行 msys.bat(它在 ruby​​ devkit 根文件夹中)

  4. cd 进入您下载 sqlite 源代码的路径(例如:如果您不熟悉 MSYS/MINGW32,则路径“c:\\dev\\sqlite3”的“cd /c/dev/sqlite3”)

  5. 运行“./configure”

  6. 运行“制作”

  7. 运行“安装”

  8. 再次获取 sqlite3 gem,这次指定平台和新编译的二进制文件的路径:

    gem install sqlite3 --platform=ruby -- --with-sqlite3-include=[path\\to\\sqlite3.h] --with-sqlite3-lib=[path\\to\\sqlite3.o]

    例如:

    gem install sqlite3 --platform=ruby -- --with-sqlite3-include=/c:/dev/sqlite3/ --with-sqlite3-lib=/c:/dev/sqlite3/.libs/

    (来自步骤 4 中给出的路径)

  9. 检查 Rails 应用程序的 Gemfile.lock 并确保它指向正确的 sqlite3 版本。 我的是“sqlite3(1.3.7-x86-mingw32)”并手动将其更改为“sqlite3(1.3.7-x64-mingw32)”。 删除平台也有效:“sqlite3 (1.3.7)”。

祝你好运!

您必须为您的操作系统安装sqlite3数据库,最好是通过您的操作系统提供的工具。 执行此操作后,再次尝试安装 gem。 您可能必须通过相同的过程解决类似的错误。

这对我有用。

sudo apt-get install libsqlite3-dev

这将在RedHatCentos上安装 Rails 所需的与 sqlite 相关的软件包:

sudo yum install sqlite sqlite-devel

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM