bcrypt をインストールしようと思い、gemfileにある #gem 'bcrypt', '~> 3.1.7' のコメントアウトを外し、bundle install を実行したところ、ターミナルに
Fetching
1Installing bcrypt 3.1.16 with native extensions 2Errno::EACCES: Permission denied @ rb_sysopen - 3/Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/.gitignore 4An error occurred while installing bcrypt (3.1.16), and Bundler cannot 5continue. 6Make sure that `gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'` 7succeeds before bundling.
と表示が出てしまいました。書いてあるサイトにてbcryptを検索し、そのサイトにインストールのコマンドが載っていたので、ターミナルにて gem install bcrypt も試しましたが、
ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/.gitignore
と出てしまいました。どうしたらインストールできるのでしょうか?
アドバイス頂いた通り、lsコマンドを順に試しました。
satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv drwxr-xr-x 5 Shun staff 160 11 20 01:58 /Users/satoushun/.rbenv satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions drwxr-xr-x 3 Shun staff 96 11 20 01:39 /Users/satoushun/.rbenv/versions satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6 drwxr-xr-x 7 Shun staff 224 11 20 01:44 /Users/satoushun/.rbenv/versions/2.6.6 satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib drwxr-xr-x 6 Shun staff 192 11 20 01:44 /Users/satoushun/.rbenv/versions/2.6.6/lib satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby drwxr-xr-x 6 Shun staff 192 11 20 01:44 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems drwxr-xr-x 3 Shun staff 96 11 20 01:44 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0 drwxr-xr-x 8 Shun staff 256 2 11 19:05 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0 satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems drwxr-xr-x 118 Shun staff 3776 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 drwxr-xr-x 15 root staff 480 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 satoushunnoMacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/.gitignore -rw-r--r-- 1 root staff 61 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/.gitignore
追記(sudo chown Shun /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 実行後)
Errno::EACCES: Permission denied @ rb_sysopen - /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby/bcrypt_jruby/BCrypt.java An error occurred while installing bcrypt (3.1.16), and Bundler cannot continue. Make sure that `gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'` succeeds before bundling.
lsコマンドにてアクセス権を調べました。
MacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 drwxr-xr-x 15 Shun staff 480 2 12 00:55 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 MacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext drwxr-xr-x 4 root staff 128 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext MacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby drwxr-xr-x 3 root staff 96 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby MacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby/bcrypt_jruby drwxr-xr-x 3 root staff 96 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby/bcrypt_jruby MacBook-Pro:cocktails Shun$ ls -ld /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby/bcrypt_jruby/BCrypt.java -rw-r--r-- 1 root staff 33955 2 11 17:52 /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/jruby/bcrypt_jruby/BCrypt.java
以前と変わった部分以前の、/Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 までは持ち主?がShunですが、それ以降はまたrootとなっているようです。rbenv等のインストール先かその他何か間違えてしまったでしょうか...?
ファイル所有者がrootのものをユーザーに変えた後のbundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 13.0.3 Using concurrent-ruby 1.1.7 Using i18n 1.8.5 Using minitest 5.14.2 Using thread_safe 0.3.6 Using tzinfo 1.2.9 Using activesupport 5.2.4.4 Using builder 3.2.4 Using erubi 1.10.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.10 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.8.0 Using rails-html-sanitizer 1.3.0 Using actionview 5.2.4.4 Using rack 2.2.3 Using rack-test 1.1.0 Using actionpack 5.2.4.4 Using nio4r 2.5.4 Using websocket-extensions 0.1.5 Using websocket-driver 0.7.3 Using actioncable 5.2.4.4 Using globalid 0.4.2 Using activejob 5.2.4.4 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.2.4.4 Using activemodel 5.2.4.4 Using arel 9.0.0 Using activerecord 5.2.4.4 Using mimemagic 0.3.5 Using marcel 0.3.3 Using activestorage 5.2.4.4 Using public_suffix 4.0.6 Using addressable 2.7.0 Using io-like 0.3.1 Using archive-zip 0.12.0 Fetching bcrypt 3.1.16 Installing bcrypt 3.1.16 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/mri /Users/satoushun/.rbenv/versions/2.6.6/bin/ruby -I /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20210214-15412-3fkfoj.rb extconf.rb creating Makefile current directory: /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/mri make "DESTDIR=" clean xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun current directory: /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16/ext/mri make "DESTDIR=" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun make failed, exit code 1 Gem files will remain installed in /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bcrypt-3.1.16 for inspection. Results logged to /Users/satoushun/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/bcrypt-3.1.16/gem_make.out An error occurred while installing bcrypt (3.1.16), and Bundler cannot continue. Make sure that `gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: bcrypt
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
この部分が赤字でエラー文かと思います
回答2件
あなたの回答
tips
プレビュー