8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcode でクリーンビルドでも解消しないエラー "The repository could not be found. Make sure a valid repository exists at the specified location and try again." をなんとか解消した話

Last updated at Posted at 2020-02-02

忙しい人向けの結論

  • File > Swift Packages > Reset Package Caches
    • Swift Package の中で問題がある場合はこれで解決するはずです
    • もし、repository 自体に問題がある場合はこれでは解決しません

対象

  • Xcode のエラーをとにかく解消したい人
    • Command + Shift + Option + K でも解消せずに困っている人
    • 本質的な原因までは書けていません(すみません)
  • Xcode 初心者

背景

  1. (前提)筆者はXcodeもSwift PackageもSwiftもずぶずぶの素人です(すみません)

    • ただ、ググってもなかなか解決できなかったのでこちらに残すことに意義を感じたため記事を書きました
  2. Xcode の開発を始めたが、以下のエラーで ビルドが失敗

    • The repository could not be found. Make sure a valid repository exists at the specified location and try again.
  3. よく効くと言われた Clean Build Folder(Command + Shift + Option + K) でも改善できず

  4. 色々ググってみたが、自分の手元のビルドは通ることがなく。。。

原因

  • Swift Package 内で git の状態が壊れていた模様

解決策

  • File > Swift Packages > Reset Package Caches で Swift Package の Cache 削除
    image.png

まとめ

  • 「Xcode で困ったら Command + Shift + Option + K 」に加えて「Swift Package で困ったら Reset Package Caches」も頭に入れる
    • 情けないお話ですが、Xcodeを使い始めて2週間くらいの私からするとこれくらいの理解で進めていくしかないかなと思いました

追記

実際には、このエラーが解消された後も別原因でエラーが出ていました。以下の記事のようにキャッシュを消すなどしてうまくいくケースも多かったのでご参考ください。
https://qiita.com/shtnkgm/items/c96a58579ec406194fa8

※ 経験的には、このエラーが出ている場合はキャッシュ周りにも問題を抱えていることが多いので、タイトルのエラーが出た場合には、本記事の内容 + 上記の記事の内容を実行していただくことで、「脳死解決」が可能かもしれません。

8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?