Cocoapods commands fail due to “No such file or directory @ dir_initialize - /Users/<username>/.cocoapods/repos (Errno::ENOENT)”

无人久伴 提交于 2019-11-27 16:54:00
Davinder

I got same problem and it was fixed after running pod setup and then pod install

Cocoapods had an issue where their github repository had become corrupted, and this forces users to clean up their local repo manually.

A quote from the Cocoapods blog post detailing the error:

Unfortunately we've encountered a bug in libgit2 and we are going to have to force push into the Specs repository. (Also known as the ‘master’ spec repo.)

What does this mean for you? Well, basically your CocoaPods setup is going to break. You are going to have to manually delete any local copies of the Specs repository and re-clone the new version of the Specs repository. You can do that with the following commands:

The Solution:

$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup

Simply running the commands above will remove the corrupted repo and reinitialize using a clean repo. See the blogpost mentioned above for more information.

Hope this helps!

I had similar issue. I deleted Pods folder and run pod install again. Problem solved.

Nothing worked for me, I had to sudo gem install cocoapods and that did the magic.

It sometimes occurs when using a wrong apostrophe character in a Podfile or in a Podspec

Those apostrophes are default when using standard TextEdit app on OS X. I prefer Sublime Text to avoid such errors

QUICK SOLUTION

A good way to solve this issue is going to specified folder and check for the file that is missing (sometimes it is there but in a rare format) and delete the file. Remove also Podfile.lock file

Then execute pod install and everything should be fine :) you don't need to remove all repos that Cocoapods have downloaded.

Done!

Tried a ton of stuff and the only fix for me was saying

brew install cocoapods

and then

brew link --overwrite cocoapods

Now it seems to be working fine.

FYI - I ran into this issue on a fresh install of cocoapods. Sounds like it's a bug that is fixed in 0.36

https://github.com/CocoaPods/guides.cocoapods.org/issues/58

I got a similar error. And I tried "pod setup", not working. Then I create a fake file which I was told missing, and then "pod update", works.

go to project directory and type command export PATH=$PATH:$HOME/Software/ruby/bin

I got the same problem, but I had to delete whole ./Pods/ directory in my project to be able to continue (the directory contained symlinks to files from other branch that were not deleted on branch switch)

I know this is an older post, but I ran into this problem when moving or deleting a .h file in a local pod. Turns out this was an issue with v0.38 and the solution was to update.

See the Github issue discussion of it here.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!