Below I’ll detail the steps I took to do the update to Capacitor 5. The steps outlined in the doc are overly simplistic, IMO (Updating to 5.0 | Capacitor Documentation).
My question is if I need to do anything based on the error I got when running npx cap migrate
:
× Upgrading gradle wrapper files - failed!
[error] gradle wrapper files were not updated
Based on the details further down in the above-linked document, I think everything is OK. But I don’t know for sure, and I’m not sure how to know for sure. The docs reference a single gradle-wrapper.properties
file, and that’s all I see in the android project. But the command says “Upgrading gradle wrapper files”, i.e. plural, and it gives an error output.
So what was the error, is there something I can and/or need to correct, and how do I know if the update / migration worked?
As to the process I had to follow for the steps in the document to work, here’s what I had to do.
-
Run
npm outdated
and keep the output that’s specifically related to the@capacitor/*
packages as well as any third-party capacitor plugin packages in your project. -
Run
npm i -D @capacitor/cli@latest
(as in the document) -
Manually update your
package.json
file to apply all the versions listed in the output ofnpm outdated
for the@capacitor/*
packages and any third-party capacitor plugin packages. -
Run
rm -rf node_modules/
andrm package-lock.json
-
Run
npm install
- make sure this works. It’s because this failed in other attempts to follow the document that I had to arrive at this procedure. -
Run
npx cap migrate
(as in the document). NOTE: This will change the@capacitor/*
package entries inpackage.json
to simply5.0.0
- which is really bad form, IMO.
It was at this point that I got the error I asked about above. But hopefully these more detailed steps help someone else.
Thanks all.