Errno::ENOENT - 没有这样的文件或目录 - env -u GIT_CONFIG git -C "[...]/.cocoapods/repos/master" conf

Posted

技术标签:

【中文标题】Errno::ENOENT - 没有这样的文件或目录 - env -u GIT_CONFIG git -C "[...]/.cocoapods/repos/master" config --get remote.origin.url (Windows 10)【英文标题】:Errno::ENOENT - No such file or directory - env -u GIT_CONFIG git -C "[...]/.cocoapods/repos/master" config --get remote.origin.url (Windows 10) 【发布时间】:2019-01-15 17:38:19 【问题描述】:

我正在尝试在 ReactNative 插件文件夹中执行“pod install”,但出现标题中出现的错误。我在 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

播客文件

# 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 插件正常工作。

任何帮助将不胜感激。

【问题讨论】:

你确定 Cocoapods 真的支持在 Windows 上运行吗?看来他们现在只支持 macOS。 @HolgerJust 不,我不确定。我正在按照安装说明进行操作:npmjs.com/package/react-native-photo-editor。我认为我可以在 windows 上开发 RN 应用程序,即使我必须在 mac 上构建最终的 iOS 推送? 【参考方案1】:

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

我找到的唯一解决方案是在 mac 上运行它。丢失的文件sw_vers 似乎是returns the version of the OS 的苹果专用实用程序。

Cocoapods docs 还提到:

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

虽然网站上没有明确提及它,但它似乎在 macOS 之外无法正常运行。

【讨论】:

以上是关于Errno::ENOENT - 没有这样的文件或目录 - env -u GIT_CONFIG git -C "[...]/.cocoapods/repos/master" conf的主要内容,如果未能解决你的问题,请参考以下文章

chef-client错误:Errno :: ENOENT:没有这样的文件或目录@ rb_sysopen-/ etc / chef / chef_guid

Open3.popen3 在 Windows 上返回错误错误 Errno::ENOENT

Python3 errno模块

zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目

zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目

如何在 Ruby 中创建文件