使用bundler/inline安装sqlite3时,未发现Gemfile错误



我想创建一个使用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

相关内容

  • 没有找到相关文章

最新更新