yarn upgradePeerdeps 报错失败

598 阅读3分钟

upgradePeerdeps 报错

  • install-peerdeps报错

image.png

安装npm install -g install-peerdeps

  • yarn upgradePeerdeps 报错

image.png

解决方式:

  # cd /usr/local/n/versions/node/11.6.0/lib/(node的安装目录下)

  # rm -rf node_modules

  # yarn cache clean

  # yarn

使用 npm run upgradePeerdeps

安装 brew

brew 是MacOS上的包管理工具,可以简化 macOS 和 Linux 操作系统上软件的安装。

1.确认安装ruby

brew是ruby开发的,需要确认ruby是否已安装,默认是已经安装的。

$ which ruby

$ruby --version

2.安装

执行命令:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

目前此命令可用,按提示选择下载源,我选的清华下载源
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

安装过程中需要输入一次用户密码

安装过程图(不要着急)

3.确认

brew --version

测试是否已安装成功

image.png

which brew

安装成功则显示路径

ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

运行

brew cleanup -d -v 

然后运行以下命令

brew install cocoapods

pod install的时候出现报错

[!] Couldn't determine repo type for URL: https://github.com/CocoaPods/Specs.git: Connection reset by peer - SSL_connect

这就意味着你的podfile文件里引入了这样的源

source 'https://github.com/CocoaPods/Specs.git'

但是由于访问github上的这个资源需要挂代理才能请求到 所以首先你需要搞一个科学上网,其次你需要安排上代理,然后找到监听的地址和端口号,like this ⬇️

然后你就只需要在终端配置一下pod的http代理就可以了,当然你也可以用sock5

git config --global http.proxy 'socks5://127.0.0.1:1080' 
git config --global https.proxy 'socks5://127.0.0.1:1080'

//看个人需要,设置其中一个就可以,当然监听到的地址和端口号需要根据你自己的来设置哦!
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080


//取消代理的方法
git config --global --unset http.proxy
git config --global --unset https.proxy

Could not automatically select an Xcode project

当把CocoaPods生成的workspace移动到上层目录时,需要改下Pods.xcconfig和工程里的一些设置,就通常没什么难度。

当遇到这个问题时:


 Could not automatically select an Xcode project. Specify one in your Podfile like so:  
 xcodeproj 'path/to/Project.xcodeproj'  

在Podfile文件里指定下工程目录就行了,比如我在Podfile文件添加这行就行了:

// xcodeproj 'Portfolio/Portfolio.xcodeproj'   
  

主要是让Pod找到子目录中的工程文件。

 

当在update或install时遇到这个问题:
 Unable to find a specification for `xxxxx (~> 1.x.x)` depended upon by Podfile.  

只需要把当前Pod的目录清理一下就行了。在终端执行以下命令:

// pod repo remove master  
// pod setup  

setup成功后执行install或update即可。

pod的http代理

source 'github.com/CocoaPods/S…'

但是由于访问github上的这个资源需要挂代理才能请求到 所以首先你需要搞一个科学上网,其次你需要安排上代理,然后找到监听的地址和端口号,like this ⬇️

然后你就只需要在终端配置一下pod的http代理就可以了,当然你也可以用sock5

git config --global http.proxy 'socks5://127.0.0.1:1080' 
git config --global https.proxy 'socks5://127.0.0.1:1080'
//看个人需要,设置其中一个就可以,当然监听到的地址和端口号需要根据你自己的来设置哦!
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
//取消代理的方法
git config --global --unset http.proxy
git config --global --unset https.proxy

pod install 报错 [!] Unable to find the Xcode project /Users/duanruilong/fanx/wright-rn/wright-rn.xcodeproj for the target Pods-wright-rn.

image.png

在工程中创建Podfile文件

终端输入:$ touch Podfile

使用vim编辑Podfile文件

终端输入:$ vim Podfile

platform :ios, '7.0'
project 'ios/taroDemo.xcodeproj'
target 'taroDemo' do
pod 'AFNetworking', '~> 3.1.0'
end

解释一下 platform :ios, '7.0'代表当前AFNetworking支持的iOS最低版本是iOS 7.0, 'MyApp'就是你自己的工程名字, pod 'AFNetworking', '~> 3.1.0'代表要下载的AFNetworking版本是3.1.0及以上版本,还可以去掉后面的'~> 3.1.0',直接写pod 'AFNetworking',这样代表下载的AFNetworking是最新版