Errno :: ENOENT-没有此类文件或目录-env -u GIT_CONFIG git -C“ [...] /。cocoapods / repos / master”配置--get remote.origin.url(Windows 10)

时间:2019-01-15 17:38:19

标签: ios ruby react-native rubygems cocoapods

我正在尝试在ReactNative插件文件夹中进行“ pod安装”,但标题中出现了错误。我正在Windows 10上运行此程序。错误模板如下:

命令

C:/Ruby25-x64/bin/pod install

报告

  • 您做了什么?

  • 您期望发生什么?

  • 发生了什么事?

堆栈

   CocoaPods : 1.5.3
        Ruby : ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]
    RubyGems : 3.0.2
        Host : Unable to find an executable (No such file or directory - sw_vers)  ()
       Xcode : -version) ()
         Git : git version 2.15.0.windows.1
Ruby lib dir : C:/Ruby25-x64/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ f403c4e44587a5045a9ed48ddca2ea6fc108b66b

插件

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!

target 'RNPhotoEditor' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for RNPhotoEditor
  pod 'iOSPhotoEditor', :git => 'https://github.com/prscX/photo-editor'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name.include?('iOSPhotoEditor')
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '4.1'
        end
      end
    end
  end

end

错误

Errno::ENOENT - No such file or directory - env -u GIT_CONFIG git -C "C:/Users/Owner/.cocoapods/repos/master" config --get remote.origin.url
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source.rb:448:in ``'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source.rb:448:in `repo_git'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source.rb:46:in `url'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source/manager.rb:347:in `block in source_with_url'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source/manager.rb:346:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source/manager.rb:346:in `find'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/source/manager.rb:346:in `source_with_url'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/sources_manager.rb:18:in `find_or_create_source_with_url'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:873:in `block in sources'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:872:in `map'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:872:in `sources'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:780:in `block in resolve_dependencies'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:779:in `resolve_dependencies'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:88:in `analyze'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
C:/Ruby25-x64/bin/pod:23:in `load'
C:/Ruby25-x64/bin/pod:23:in `<main>'

如果我去那一行,我会发现以下内容:

def repo_git(args, include_error: false)
  command = "env -u GIT_CONFIG git -C \"#{repo}\" " << args.join(' ')
  command << ' 2>&1' if include_error
  (`#{command}` || '').strip #<--this line here
end

如果我只是运行“ ruby​​ env”,则会得到以下信息:

Traceback (most recent call last):
ruby: No such file or directory -- env (LoadError)

此外,如果我仅运行“ env”,则会收到未找到预期的错误消息:“ env”未被识别为内部或外部命令, 可操作的程序或批处理文件。因此,我认为这意味着系统无法识别env命令,但是似乎有必要运行“ pod install”。

我在使env在Windows上工作时做了一些谷歌搜索,但是可以肯定的是我没有正确搜索我的问题,因为我没有找到结果。我想到目前为止,我已经安装了ruby,ruby gems和cocoapods,试图使RN插件正常工作。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

可能为时已晚,但以防万一,我遇到了在cocoapods版本1.5.31.7.2上在Linux上运行相同命令的相同错误。

我发现的唯一解决方案是在Mac上运行它。丢失的文件sw_vers似乎是returns the version of the OS的Apple特定实用程序。

Cocoapods docs也提到:

  

CocoaPods管理您的Xcode项目的库依赖项。

尽管在站点上的任何地方都没有明确提及,但它似乎无法在macOS外部正常运行。