1.安装HomeBrew一直卡住
git fetch origin master:refs/remotes/origin/master --tags --force
参考方案:
https://www.jianshu.com/p/c8d998903a6a
2./Users/xxxxx/.rbenv/shims/ruby: line 21: /usr/local/Cellar/rbenv/1.1.1/libexec/rbenv: No such file or directory
解决方案:
安装 rbenv
brew install rbenv
3.升级MacOS ,或者升级Xcode,遇到
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- xcodeproj (LoadError)
解决方案:
终端执行 sudo gem install xcodeproj
4.长时间未更新CocoaPods、或者升级了Mac OS,导致pod install无效
报错
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
解决方案:
sudo gem install -n /usr/local/bin cocoapods
这个过程需要时间比较久,需要耐心等待下;
执行完后,再执行 pod install,如果遇到
[!] CDN: trunk Repo update failed - 22 error(s):
在Podfile文件下添加下面,即可
source 'https://github.com/CocoaPods/Specs.git'
5.ReactNative 项目执行npm install,报以gyp错误
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/zhangxi/Desktop/YunCode/RNSummaryCode/node_modules/fsevents
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
解决方案
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
6、更新自己维护的CocoaPods的库时,执行‘pod trunk push ZHXIndexView.podspec --allow-warnings ’ 遇到
[!] CDN: trunk Repo update failed - 2 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/1/e/4/AFOAuth2Client/1.0.0/AFOAuth2Client.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/a/a/6/AFAmazonS3Client/2.0.1/AFAmazonS3Client.podspec.json Response: Couldn't connect to server
解决方案:
1、通过查iP的网站ipaddress,查找到raw.githubusercontent.com/对应的IP;
2、在本地host文件最后一行,添加
199.232.68.133(你自己查到的ip地址) raw.githubusercontent.com
3、重新执行pod trunk push 即可。