The proper way to upgrade Strapi is:
1. Create a branch first
git checkout -b chore/upgrade-strapi-5.x
2. Use Strapi's official upgrade tool
cd backend
npx @strapi/upgrade minor # or 'major' for a major version bump
This updates package.json and runs npm install to regenerate package-lock.json in a controlled way, and it runs any required codemods for breaking changes.
3. Test locally before committing anything
npm run build
npm run develop
Make sure the admin panel loads, your content types are intact, and your API endpoints respond correctly. Strapi has had breaking changes between minor versions before, so don't skip this.
4. Stage and review the diff carefully
git diff backend/package.json # confirm only the version you intended changed
git add backend/package.json backend/package-lock.json
git commit -m "chore: upgrade strapi from 5.26.0 to 5.46.0"

Only the three Strapi packages changed, nothing else in package.json. That's the green light to proceed.
Never blindly git add . after an upgrade — always read the package.json diff first.
5. Push the branch and open a PR
git push origin chore/upgrade-strapi-5.x
Let CI/your deployment preview build it before it touches main. If your cloud host builds PRs, you'll see the build pass or fail before merging.