无法在 ubuntu 20.04 上安装 bcrypt

问题描述

我的项目有 ruby​​ 2.6.5、rails 6,当我尝试运行 bundle install 时,bcrypt gem 没有安装。我尝试了 sudo apt-get install ruby​​-devsudo apt-get install build-essential 命令来解决问题,但它们没有帮助。 任何人都可以帮助解决这个问题?

下面是它的日志。

Fetching bcrypt-3.1.11.gem
Building native extensions. This Could take a while...
ERROR:  Error installing bcrypt:
ERROR: Failed to build gem native extension.

current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
/home/mahesh/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/mahesh/.rvm/rubies/ruby- 
2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210222-10360-1tmu5r0.rb extconf.rb
creating Makefile

current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR=" clean

current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.so

current directory: /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11/ext/mri
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.time] Error 127

make install Failed,exit code 2

Gem files will remain installed in /home/mahesh/.rvm/gems/ruby-2.6.5/gems/bcrypt-3.1.11 for 
inspection.
Results logged to /home/mahesh/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/bcrypt- 
3.1.11/gem_make.out

解决方法

该软件包会查找 /usr/bin/mkdir,但在基于 Debian 的系统上,正确的路径是 /bin/mkdir。 Op通过创建符号链接解决了这个问题。最好修复安装程序。