k12da
@k12da (K Yoshida)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

「bcrypt のインストール中にエラーが発生しました (3.1.18)、Bundler は続行できません。」というエラーが出る。

解決したいこと

deviseというgemを追加して、bundle installしたときに、タイトルのようなエラーが発生しました。

Gemfile.
gem 'devise', '4.8.1'

発生している問題・エラー

/api # bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies........
Using rake 13.0.6
Using concurrent-ruby 1.1.10
Using minitest 5.16.3
Using builder 3.2.4
Using erubi 1.11.0
Using racc 1.6.0
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using mini_mime 1.1.2
Using digest 3.1.0
Using timeout 0.3.0
Using strscan 3.0.4
Using ast 2.4.2
Using rack 2.2.4
Using msgpack 1.5.6
Using uniform_notifier 1.16.0
Using bundler 2.3.20
Using json_schema 0.21.0
Using openapi_parser 0.15.0
Using method_source 1.0.0
Using thor 1.2.1
Using zeitwerk 2.6.0
Using io-console 0.5.11
Fetching orm_adapter 0.5.0
Using crass 1.0.6
Using marcel 1.0.2
Using docile 1.4.0
Using romaji 0.2.4
Using diff-lcs 1.5.0
Using parallel 1.22.1
Fetching bcrypt 3.1.18
Using pg 1.4.3
Using rainbow 3.1.1
Using json 2.6.2
Using rexml 3.2.5
Using rubyzip 2.3.2
Using regexp_parser 2.5.0
Using ruby-progressbar 1.11.0
Using unicode-display_width 2.2.0
Using silencer 2.0.0
Using simplecov-html 0.12.3
Using simplecov_json_formatter 0.1.4
Using rspec-support 3.11.0
Using tzinfo 2.0.5
Using i18n 1.12.0
Using nokogiri 1.13.8 (aarch64-linux)
Using rack-test 2.0.2
Using websocket-driver 0.7.5
Using mail 2.7.1
Using net-protocol 0.1.3
Using bootsnap 1.13.0
Using committee 4.4.0
Using reline 0.3.1
Fetching warden 1.2.9
Using parser 3.1.2.1
Using puma 5.6.5
Using rack-cors 1.1.1
Using gimei 1.1.0
Using loofah 2.18.0
Using net-imap 0.2.3
Using net-pop 0.1.1
Using net-smtp 0.3.1
Using irb 1.4.1
Using faker 2.22.0
Using roo 2.9.0
Using rspec-core 3.11.0
Using rspec-expectations 3.11.0
Using rspec-mocks 3.11.1
Using simplecov 0.21.2
Using activesupport 7.0.3.1
Using rails-html-sanitizer 1.4.3
Using rubocop-ast 1.21.0
Using debug 1.6.2
Using rails-dom-testing 2.0.3
Using globalid 1.0.0
Using activemodel 7.0.3.1
Using bullet 7.0.3
Using factory_bot 6.2.1
Using shoulda-matchers 5.1.0
Using rubocop 1.35.1
Using actionview 7.0.3.1
Using activejob 7.0.3.1
Using activerecord 7.0.3.1
Using rubocop-performance 1.14.3
Using rubocop-rails 2.15.2
Using rubocop-rspec 2.12.1
Using actionpack 7.0.3.1
Using actioncable 7.0.3.1
Using activestorage 7.0.3.1
Using actionmailer 7.0.3.1
Using railties 7.0.3.1
Using actionmailbox 7.0.3.1
Using actiontext 7.0.3.1
Using committee-rails 0.6.1
Fetching responders 3.0.1
Installing orm_adapter 0.5.0
Installing warden 1.2.9
Installing responders 3.0.1
Installing bcrypt 3.1.18 with native extensions
Using factory_bot_rails 6.2.0
Using rails-i18n 7.0.5
Using rspec-rails 5.1.2
Using rails 7.0.3.1
Gem::Ext::BuildError: ERROR: Failed to build gem native
extension.

current directory:
/usr/local/bundle/gems/bcrypt-3.1.18/ext/mri
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.1.0 -r
./siteconf20221124-798-mb8hcb.rb extconf.rb
creating Makefile

current directory:
/usr/local/bundle/gems/bcrypt-3.1.18/ext/mri
make DESTDIR\= clean
current directory:
/usr/local/bundle/gems/bcrypt-3.1.18/ext/mri
make DESTDIR\=
make failedNo such file or directory - make

Gem files will remain installed in
/usr/local/bundle/gems/bcrypt-3.1.18 for inspection.
Results logged to
/usr/local/bundle/extensions/aarch64-linux-musl/3.1.0/bcrypt-3.1.18/gem_make.out

/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:70:in
`rescue in run'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:67:in
`run'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:44:in
`block in make'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`each'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`make'
/usr/local/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
  /usr/local/lib/ruby/3.1.0/tempfile.rb:317:in `open'
/usr/local/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in
`build_extension'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in
`block in build_extensions'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`each'
/usr/local/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`build_extensions'
/usr/local/lib/ruby/3.1.0/rubygems/installer.rb:853:in
`build_extensions'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/source/rubygems.rb:207:in
`install'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/worker.rb:62:in
`apply_func'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/worker.rb:57:in
`block in process_queue'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/worker.rb:54:in
`loop'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/worker.rb:54:in
`process_queue'
/usr/local/bundle/gems/bundler-2.3.20/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing bcrypt
(3.1.18), and Bundler cannot continue.

In Gemfile:
  devise was resolved to 4.8.1, which depends on
    bcrypt

自分で試したこと

エラーに記載していたbcrypt(3.1.18)をGemfileに入れて、再度bundle installしましたが、
同じエラーが発生しました。

Gemfile.
gem 'devise', '4.8.1'
gem 'bcrypt', '~> 3.1.18' #追加
1

1Answer

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

から

laravel のインストールで 何回,yum install -y php-xxxxx やyum install
-y gcc make を実行したことか?

php -m でモジュール一覧がみれますが、
gem はなんでしたか?

基礎コマンドかrubyの基礎ライブラリーが不足していると思います。
上のurlでトライしては?

1Like

Comments

  1. @k12da

    Questioner

    上のURL試してみて、変わらずエラーになりました。

    一応ですが、以下を実行して解決しました。
    ・brew updateを実行(他の記事で調べて試しました。これが原因かは不明です)
    ・Gemfileを修正後にdockerで、docker compose build→docker compose upの後にbundle install実行
  2. 原因不明は歯がゆいですが
    おめでとうございます。

Your answer might help someone💌