[Bug]: Generated Android and iOS SPM plugin paths break with external virtual store
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java, javascript, nodejs, swift, typescript
- Lĩnh vực
- build-system, cli, mobile-dev
Hướng nghiên cứu
The issue is in the path generation logic of the Capacitor CLI's update command for Android and iOS. Look at the code that writes capacitor.settings.gradle and ios/App/CapApp-SPM/Package.swift, likely in @capacitor/cli. The plugin.rootPath calculation needs to handle external virtual stores. Start by tracing how plugin paths are resolved in native-run.ts or the update utilities. Test with pnpm's global virtual store to verify the fix.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
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:
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:
.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
Additional Information
Reproduction Steps
-
Create a Capacitor application using pnpm.
-
Add Android and iOS, configuring iOS to use Swift Package Manager.
-
Install at least one Capacitor plugin, for example
@capacitor/app. -
Enable pnpm's global virtual store:
# pnpm-workspace.yaml, pnpm 11.20 enableGlobalVirtualStore: trueOn newer pnpm versions, the equivalent setting is:
virtualStoreType: global -
Remove
node_modulesand reinstall:rm -rf node_modules pnpm install -
Regenerate the native dependency configuration:
pnpm exec cap update android pnpm exec cap update ios -
Inspect
android/capacitor.settings.gradleandios/App/CapApp-SPM/Package.swift. -
Observe that their generated
node_modules/.pnpm/...paths do not exist. -
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 17.1k
- Fork
- 1.3k
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ionic-team/capacitor
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ionic-team/capacitor#8759 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Plugin call after navigation can be answered before reply proxy is updatedCó thể đã có người làm @MateStrysewske đã nhận 71 ngày trước. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ionic-team/capacitor#8616 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ionic-team/capacitor#8574 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16)Có thể đã có người làm @kttalley đã nhận 62 ngày trước. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor#8530 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(android): remove unchecked Java compilation warningsCó thể đã có người làm @Ajamuar đã nhận 15 ngày trước. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor#8529 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ionic-team/capacitor
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
prio:low scope:world
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
OliverRomhagen/vrigstad-joyride#849 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
genfeedai/genfeed.ai#11916 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
erkamyaman/rust-anything#1153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The Phase 5 report says 0.3.0 waits for the live checkCó thể đã có người làm @fzn0x đã nhận hôm nay. Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày