Cocoapods安装时遇到的坑!

来源:互联网 发布:淘宝客服主管提成方案 编辑:程序博客网 时间:2024/04/25 02:07

可能是之前安装了,然后升级系统之后,现在需要用到,发现死活运行不起来。

1、之前运行pod setup,还会提示 /usr/local/bin 这个文件夹只可读,无法操作,我们只需要更改下他的读写权限即可

sudo chmod go-w /usr/local/bin


2、

$ pod setup

Setting up CocoaPods master repo

fatal: Not a git repository (or any of the parent directories): .git

[!] The `master` repo is not a git repo.


这是说明没有找到.git目录,只需要使用git创建一个目录即可:

git init


3、

$ pod setup

Setting up CocoaPods master repo

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

  $ /usr/local/bin/git -C /Users/guojicheng/.cocoapods/repos/master fetch origin

  --progress

  fatal: 'origin' does not appear to be a git repository

  fatal: Could not read from remote repository.

  

  Please make sure you have the correct access rights

  and the repository exists.

[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`


安装后,还是有问题,说不能设置环境,之后按照这提示运行了pod repo update --verbose 但是依然不行。之后试了下加sudo

sudo pod setup

Password:

/usr/local/lib/ruby/gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!':[!] You cannot run CocoaPods as root. (CLAide::Help)

这里看到关键问题了,You cannot run CocoaPods as root 这就好办了。

只要先删除之前的目录:

sudo rm -fr ~/.cocoapods/repos/master

这个时间可能有点长,因为里面有好几百兆的文件呢,等他删除完毕在运行

pod setup

之后就是下载最新的东西了,输出如下:

$ pod setup

Setting up CocoaPods master repo

  $ /usr/local/bin/git clone https://github.com/CocoaPods/Specs.git master

  --progress

  Cloning into 'master'...

  remote: Counting objects: 1631882, done.       

  remote: Compressing objects: 100% (334/334), done.       

  remote: Total 1631882 (delta 140), reused 35 (delta 35), pack-reused 1631505       

  Receiving objects: 100% (1631882/1631882), 435.48 MiB | 1.47 MiB/s, done.

  Resolving deltas: 100% (869406/869406), done.

  Checking connectivity... done.

  Checking out files: 100% (191990/191990), done.


CocoaPods 1.4.0.beta.2 is available.

To update use: `sudo gem install cocoapods --pre`

[!] This is a test version we'd love you to try.


For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.4.0.beta.2


Setup completed


这里会很慢,因为要下载很多东西,差不多有900多兆吧,慢慢等吧~




原创粉丝点击