我在react native上运行移动开发。安装一个包后,我开始得到一些模块在pod上找不到的错误。所以我决定更新整个包。Json与新模块经过几次不成功的研究尝试。但是当尝试重新安装pod时,问题仍然存在。
所以我决定通过brew更新pod本身,但它并不成功。尽管我也卸载和安装,它仍然是相同的
我尝试的其他事情是更新gem和rvm,我试图安装cocoapods,结果没有差异
我尝试了不同时间的命令列表
sudo gem install cocoapods
gem install cocoapods --user-install
sudo gem install -n /usr/local/bin cocoapods
sudo gem install -n /usr/local/bin cocoapods -v 1.8.4
brew install cocoapods
这是我的。bash_profile
....
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
source $(dirname $(gem which colorls))/tab_complete.sh
alias lc='colorls'
通过啤酒
Traceback (most recent call last):
16: from /usr/local/Cellar/cocoapods/1.11.3/libexec/bin/pod:23:in `<main>'
15: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
13: from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1434:in `block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1434:in `block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
2: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
1: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1428:in `block in activate_dependencies'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'minitest' (>= 5.1) among 41 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/mac/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.3/libexec' , execute `gem env` for more information
16: from /usr/local/Cellar/cocoapods/1.11.3/libexec/bin/pod:23:in `<main>'
15: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
13: from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1434:in `block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1434:in `block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `activate'
3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `activate_dependencies'
2: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1416:in `each'
1: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1427:in `block in activate_dependencies'
/Library/Ruby/Site/2.6.0/rubygems/specification.rb:1430:in `rescue in block in activate_dependencies': Could not find 'minitest' (>= 5.1) among 41 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/mac/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.3/libexec' at: /usr/local/Cellar/cocoapods/1.11.3/libexec/specifications/activesupport-6.1.5.gemspec, execute `gem env` for more information
通过宝石
WARNING: You don't have /Users/mac/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/mac/.gem/ruby/2.6.0/gems/ffi-1.15.5/CHANGELOG.md
Sylvester @ sudo gem install cocoapods --user-install
Password:
WARNING: You don't have /Users/mac/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Users/mac/.gem/ruby/2.6.0/gems/ffi-1.15.5/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20220625-94173-1we5ltp.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:10:in `system_libffi_usable?'
from extconf.rb:42:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/mac/.gem/ruby/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/mac/.gem/ruby/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Users/mac/.gem/ruby/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/gem_make.out
请帮帮我,我被卡住了。提前谢谢。
我能够通过简单地通过Visual Studio Code打开终端来解决这个问题,这显示了我的Mac所需的Ruby。
rvm install "ruby-2.7.4”
sudo gem install cocoapods
一切都成功了!