ruby MacOS react本机错误提示器:无法加载命令:pod

lkaoscv7  于 12个月前  发布在  Ruby
关注(0)|答案(4)|浏览(101)

我尝试在react native中创建一个新项目:

npx react-native@latest init myApp

> gem which cocoapods

/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb

在创建项目时,我得到了这个:

Installing CocoaPods dependencies (this may take a few minutes)
error bundler: failed to load command: pod (/Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod)
/Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from <internal:/Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod:25:in `load'
    from /Users/nameUser/Desktop/proj/myApp/vendor/bundle/ruby/3.2.0/bin/pod:25:in `<top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:492:in `exec'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:28:in `start'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.20/exe/bundle:37:in `block in <top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /Users/nameUser/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.20/exe/bundle:29:in `<top (required)>'
    from /Users/nameUser/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
    from /Users/nameUser/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/environment-setup?os=macos&platform=android and follow the React Native CLI QuickStart guide for macOS and iOS.

你能给予我一只手吗?

bxpogfeg

bxpogfeg1#

我也经历过这个,在一个旧版本的Ruby下。我认为这与最近对react-native repo的提交有关:
https://github.com/facebook/react-native/commit/ce39931bc2b02f13cbc5751ba4d4a6dbc07bc91a
我想我已经找到了一个解决方法(除非有一些新的先决条件没有文档记录,否则我不Au Ruby生态系统)
在检查@react-native-community/cli包后,失败的命令是bundle exec pod install
如果你重新运行init project命令,让它失败,然后cd YourProjectName/ios/ && pod install,它应该为你工作,就像官方安装程序成功完成一样。
从那里你可以yarn start和iOS上运行的应用程序,Android等.

dauxcl2d

dauxcl2d2#

我在这个PR的基础上修复了它,并将下面一行添加到我的Gemfile中

gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

然后重新运行pod install

ogsagwnx

ogsagwnx3#

这似乎是activesupport新版本中的一个bug。您可以降级,直到找到正确的版本。您可能需要更新您的Podfile格式以匹配不同的版本。
举例来说:

gem uninstall activesupport -v 7.1.1
gem install activesupport -v  7.0.8
ycggw6v2

ycggw6v24#

gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
Mike S.解决了我的问题,一个小的变化。我必须先运行bundle install exec pod install,随后的pod install命令才能工作。

相关问题