Package.resolved file is corrupted or malformed; fix or delete the file to continue: unknown ‘PinsStorage’ version ‘3’
Missing package product ‘ ’
When cloning a new project and trying to build it, you might encounter the error: "Package.resolved file is corrupted or malformed; fix or delete the file to continue: unknown 'PinsStorage' version '3'" and "Missing package product."
Here's what I tried:
- Reset Package Caches: From Xcode, go to
File
→Packages
→Reset Package Caches
. Unfortunately, this didn't work. - Delete DerivedData: I deleted the DerivedData, but the issue persisted.
Here’s the solution that worked for me:
Step 1. Close Your Project: Close the Xcode project.
Step 2. Delete the Package.resolved File:
- Open Finder and locate your
project.xcodeproj
. - Right-click on it and select
Show Package Contents
. - Navigate to
project.xcworkspace
→xcshareddata
→swiftpm
. - Delete the
Package.resolved
file and empty the bin.
Step 3. Reopen Your Project: Open the project in Xcode.
Step 4. Build Your Project: The project should build successfully now.
The Package.resolved
file is similar to a Podfile.lock
in CocoaPods. When you encounter package issues, deleting it and rebuilding the project will generate a new one.
If this post helped you, please give me a 👏.