使用 bundler/inline 安装 sqlite3 时找不到 Gemfile 错误
Gemfile not found error when installing sqlite3 with bundler/inline
我想创建一个使用 ActiveRecord 的 Minitest 示例。我正在使用 bundler/inline
:
安装所需的 gem
# activerecord_bug_test.rb
require "bundler/inline"
gemfile(true) do
source "http://rubygems.org"
gem "activerecord", "6.0.2.2"
gem "sqlite3", "1.4.2"
end
# test code
当我 运行 bundle exec ruby activerecord_bug_test.rb
它失败
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/installer/parallel_installer.rb:197:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)
current directory: /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/hirurg103/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20200324-11504-1f7q6pd.rb extconf.rb
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/definition.rb:32:in `build': /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3/Gemfile not found (Bundler::GemfileNotFound)
...
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'` succeeds before bundling.
当我用
安装sqlite3
时
gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'
一切顺利
您知道如何解决这个问题吗?谢谢
删除 bundle exec
前缀为我修复了错误:
ruby activerecord_bug_test.rb
我想创建一个使用 ActiveRecord 的 Minitest 示例。我正在使用 bundler/inline
:
# activerecord_bug_test.rb
require "bundler/inline"
gemfile(true) do
source "http://rubygems.org"
gem "activerecord", "6.0.2.2"
gem "sqlite3", "1.4.2"
end
# test code
当我 运行 bundle exec ruby activerecord_bug_test.rb
它失败
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/installer/parallel_installer.rb:197:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)
current directory: /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/hirurg103/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20200324-11504-1f7q6pd.rb extconf.rb
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/definition.rb:32:in `build': /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3/Gemfile not found (Bundler::GemfileNotFound)
...
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'` succeeds before bundling.
当我用
安装sqlite3
时
gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'
一切顺利
您知道如何解决这个问题吗?谢谢
删除 bundle exec
前缀为我修复了错误:
ruby activerecord_bug_test.rb