我在初始化 React Native 项目时遇到错误。 Macbook M1,我已经尝试通过brew安装并清除缓存。但我不明白错误是什么,为什么 json 文件无法读取或者不是那个错误。
我已经重新安装了 macOS,rm -rf ~/.cocoapods/repos/trunk/ 和其他东西,重新安装 - 没有任何帮助!
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
JSON::ParserError - Failed to parse JSON at file: '/Users/mykytakhaliavkin/.cocoapods/repos/trunk/Specs/a/e/a/Flipper/0.232.0/Flipper.podspec.json'.
unexpected token at ''
/Users/mykytakhaliavkin/RN6/vendor/bundle/ruby/2.6.0/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'
您需要更换网络。运行后连接VPN
pod install
我也遇到同样的问题。更改网络没有帮助。
我遇到了同样的问题,这似乎是其他人也遇到的问题 - https://github.com/CocoaPods/CocoaPods/issues/12115
我发现的唯一两个临时解决方案是:
~/.cocoapods/repos/trunk/Specs/a/e/a/Flipper/0.232.0/Flipper.podspec.json
)在空的上面。或
Podfile
中指定源的行从 source 'https://cdn.cocoapods.org/'
更改为 source 'https://github.com/CocoaPods/Specs.git'
(如果缺少,则将其添加到顶部)。这样 pod install 需要更长的时间,但至少它可以工作。