我正在尝试按照本指南将电容器从 5 个升级到 6 个
https://capacitorjs.com/docs/updating/6-0#using-the-cli-to-migrate
但是当我这样做时,我有:
✖ Installing Latest Modules using npm. - failed!
[error] npm install failed. Try deleting node_modules folder and running npm install --force manually.
[error] Unable to find [email protected]. Try updating it manually
✔ Update App Icon to only 1024 x 1024 in 391.79μs
✔ Remove Podfile.lock from iOS .gitignore in 331.92μs
✔ Migrating build.gradle file. in 6.71ms
✔ Remove android.enableJetifier=true from gradle.properties in 363.96μs
[error] Found namespace in build.gradle already, skipping migration
✔ Migrating package from Manifest to build.gradle in 460.83μs
✔ Migrating gradle-wrapper.properties by updating gradle version to 8.0.2. in 479.67μs
✔ Migrating variables.gradle file. in 2.82ms
[warn] Skipped migrating package from Manifest to build.gradle in Capacitor plugins
[warn] Skipped Running cap sync.
[warn] Skipped upgrading gradle wrapper files
✔ Writing breaking changes. in 125.63μs
[warn] Migration to Capacitor ^5.0.0 is incomplete. Check the log messages for more information.
看起来您跳过了安装最新 Capacitor CLI 的第一步,而是仍在运行版本 5.x,因此会显示奇怪的消息,因为您是从 5 更新到 5。
运行
npm i -D @capacitor/cli@latest
并再次运行 npx cap migrate
,确保它告诉您正在更新到 Capacitor 6。