安装 puma 后捆绑安装失败

bundle install fails after installing puma

我是 运行 bundle install,它在中间失败并出现错误:

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

    current directory: /Users/Mahmoud/dev-reps/non-docker/normal/vendor/bundle/ruby/2.5.0/gems/puma-4.3.1/ext/puma_http11
/Users/Mahmoud/.rbenv/versions/2.5.5/bin/ruby -r ./siteconf20220308-96584-8zjcoy.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
checking for BIO_read() in -lcrypto... yes

...
...
An error occurred while installing puma (4.3.1), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.1' --source 'http://rubygems.org/'` succeeds before bundling.

在安装 puma 失败后,经过多次搜索和尝试,我能够通过以下方式安装它:

gem install puma:4.3.1 -- --with-cflags="-Wno-error=implicit-function-declaration"

并且 gem 安装成功,给出:

Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed puma-4.3.1
Parsing documentation for puma-4.3.1
Done installing documentation for puma after 0 seconds
1 gem installed

我目前的问题是再次尝试 bundle install 仍然失败并出现相同的错误。尝试重新启动终端,但仍然相同。就好像根本没有安装puma一样。我做错了什么?

终于使用以下方式获得了捆绑包:

bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"

来自这个回答