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:

  1. Install patch-package:

    npm install patch-package --save-dev
  2. Add a post-install script to your package.json so the patch is automatically re-applied whenever npm install runs:

    "scripts": {
      "postinstall": "patch-package"
    }
  3. Edit the plugin source file: Open node_modules/cap-codepush/dist/esm/codePush.js and locate the queryUpdate function (around line 170). Set localPackage.packageHash to null right before the update query is made.

  4. Generate the patch file by running the following command from your project root:

    npx patch-package cap-codepush

    This will create a /patches directory at the root of your project containing a file such as cap-codepush+2.0.0.patch.

  5. Commit the /patches directory 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: