#8621·capacitor

[Bug]: Generated Android and iOS SPM plugin paths break with external virtual store

Author: sandstromCreated Sep 23, 2026Updated Sep 23, 2026
Labelstriage

Capacitor Version

Installed Dependencies:

@capacitor/cli: 8.5.0 @capacitor/core: 8.5.0 @capacitor/android: 8.5.0 @capacitor/ios: 8.5.0

Other API Details

bash
pnpm: 11.20.0
Node.js: 26.6.0
OS: macOS
@capacitor/cli: 8.5.0
@capacitor/android: 8.5.0
@capacitor/ios: 8.5.0
iOS package manager: Swift Package Manager

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

capacitor update generates native plugin paths that do not exist when dependencies use a virtual store outside the project.

One way to reproduce this is pnpm's global virtual store. With enableGlobalVirtualStore: true on pnpm 11.20, or virtualStoreType: global on newer pnpm versions, the physical dependency graph is stored outside the project.

Despite this, capacitor update android generates entries similar to:

gradle
project(':capacitor-app').projectDir = new File('../../../node_modules/.pnpm/@capacitor+app@.../node_modules/@capacitor/app/android')

Likewise, capacitor update ios with Swift Package Manager generates entries similar to:

swift
.package(
    name: "CapacitorApp",
    path: "../../../../../node_modules/.pnpm/@capacitor+app@.../node_modules/@capacitor/app"
)

Under the global virtual-store layout, the project-local node_modules/.pnpm directory does not contain these packages. Consequently, Gradle and Swift Package Manager cannot resolve the generated plugin paths.

Switching back to pnpm's project-local virtual store, reinstalling dependencies, and rerunning capacitor update produces paths that exist and allows both native projects to resolve their dependencies.

The global virtual store is one concrete case where this breaks. More generally, generated paths appear to assume that a plugin's resolved package location can always be represented inside the project's local virtual store. Other symlinked or externally located dependency layouts may expose the same assumption.

Expected Behavior

Capacitor should generate Android Gradle and iOS SPM paths that resolve to the installed plugin directories, regardless of whether the package manager stores their physical contents inside or outside the project.

The generated files could reference stable project-level package symlinks or otherwise account for the physical package location. The exact representation is less important than ensuring every generated path exists.

Project Reproduction

https://see-below.example.com

Additional Information

Reproduction Steps

  1. Create a Capacitor application using pnpm.

  2. Add Android and iOS, configuring iOS to use Swift Package Manager.

  3. Install at least one Capacitor plugin, for example @capacitor/app.

  4. Enable pnpm's global virtual store:

    yaml
    # pnpm-workspace.yaml, pnpm 11.20
    enableGlobalVirtualStore: true

    On newer pnpm versions, the equivalent setting is:

    yaml
    virtualStoreType: global
  5. Remove node_modules and reinstall:

    bash
    rm -rf node_modules
    pnpm install
  6. Regenerate the native dependency configuration:

    bash
    pnpm exec cap update android
    pnpm exec cap update ios
  7. Inspect android/capacitor.settings.gradle and ios/App/CapApp-SPM/Package.swift.

  8. Observe that their generated node_modules/.pnpm/... paths do not exist.

  9. Attempt to resolve or build either native project.

Additional Information

Android path generation calculates relative paths from each plugin's rootPath when writing capacitor.settings.gradle.

iOS SPM path generation similarly uses plugin.rootPath when writing CapApp-SPM/Package.swift.

A related historical report is #7081, but it was closed because no reproduction was provided and does not specifically cover pnpm's global virtual store.