How do I fix the CodePush differential update crash in Ionic Capacitor (iOS Simulator)?
Last updated: July 27, 2026
Context
When integrating CodePush (via the cap-codepush plugin) into an Ionic Capacitor application, you may encounter an error on iOS Simulator during a differential update (i.e., the second release and onwards). This is a known bug related to how the cap-codepush plugin interacts with the @capacitor/filesystem plugin when handling local packages during an update.
Answer
There are two possible solutions depending on your Capacitor version:
Option 1 – Upgrade to Capacitor 6+ (Recommended)
If you are able to migrate your project to Capacitor 6 or newer, upgrading to cap-codepush@3 or higher includes the necessary bug fixes and updated @capacitor/filesystem handling that resolves this issue.
Option 2 – Apply a local patch using patch-package
If upgrading is not currently possible, you can apply a local patch to the cap-codepush plugin using patch-package. Follow these steps:
Install
patch-package:npm install patch-package --save-devAdd a post-install script to your
package.jsonso the patch is automatically re-applied whenevernpm installruns:"scripts": { "postinstall": "patch-package" }Edit the plugin source file: Open
node_modules/cap-codepush/dist/esm/codePush.jsand locate thequeryUpdatefunction (around line 170). SetlocalPackage.packageHashtonullright before the update query is made.Generate the patch file by running the following command from your project root:
npx patch-package cap-codepushThis will create a
/patchesdirectory at the root of your project containing a file such ascap-codepush+2.0.0.patch.Commit the
/patchesdirectory to your Git repository so the patch is preserved for all team members and CI/CD builds.
If you continue to experience issues after applying the patch, consider reaching out directly to the cap-codepush plugin maintainers on their GitHub repository for an official workaround.
Additional references: