Error “Missing package product“ for Swift Packages (SPM)
See how to fix the “Missing package product“ error in Xcode caused by some Swift Packages added through SPM.
• 2 min read
Error
Missing package product <package name>
Problem
Have you added some Swift Packages and, after that everything worked perfectly, Xcode thrown this error?
After multiple attempts, I found this solution that worked perfectly.
Solution
- Close Xcode
- Open
Terminalwhere the directory of your.xcodeprojis - Run
xcodebuild -resolvePackageDependencies - Check, if any, which Swift Package is throwing an error
- Then, open Xcode and downgrade the Swift Package that is causing the problem to the previous version
- Clean, build and check if the error is gone
- Then, if you can't use earlier versions of the library, try reinstalling the latest version. It may work again.
In my case, the Swift Package that was causing the error was FirebaseFirestore.
This is the result of xcodebuild -resolvePackageDependencies.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Resolve Package Graph
checksum of downloaded artifact of binary target 'FirebaseFirestore'
(4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4) does not match checksum
specified by the manifest (bb362e131fda776d6911e553516439fe7d3744a213c6720ee9d58ebc5b6de789)
Resolved source packages:
NetworkingInterface: (null)
2023-05-18 15:41:11.800 xcodebuild[4261:25804] Writing error result bundle to /var/folders/f9/yqxrfs4d3jbb047fxtkn918m0000gp/T/ResultBundle2023-18-0515-41-0011.xcresultfatalError
xcodebuild: error: Could not resolve package dependencies:
checksum of downloaded artifact of binary target 'FirebaseFirestore'
(4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4) does not match checksum specified by the manifest (bb362e131fda776d6911e553516439fe7d3744a213c6720ee9d58ebc5b6de789)
fatalError
As you can see the checksum of downloaded artifact of binary target 'FirebaseFirestore' does not match checksum specified by the manifest.
This was blocking Xcode from resolving the package dependencies.
Alternative solutions
- Discard changes under git
- Clean project
- Clean derived data
- Resolve Package Versions (File > Packages)
- Reset Package Cache (File > Packages)
- Update to Latest Package Versions (File > Packages)
- Restart Xcode
- Restart Mac
Conclusion
Hope this will fix your issue.
If you have any question about this article, feel free to email me or tweet me @franceleonidev and share your opinion.
Thank you for reading and see you in the next article!
Share this article