How Do You Update Dependencies Without Breaking Your App?
Run npm audit to see known vulnerabilities, fix what affects your live app, and test after each update. Let Dependabot open pull requests for you if you're on GitHub. Before installing any package an AI suggests, check that it's real and is the one you meant. Avoid npm audit fix --force unless you know what it will change.
Check this project's dependencies. Don't install or change anything yet. 1. Run `npm audit --omit=dev` and explain each finding in plain language: what the package does here, whether my code actually uses the affected part, and how urgent it is. 2. Run `npm outdated` and separate patch, minor and major updates. 3. List packages I don't use, and packages that do the same job as each other. 4. For each package added in the last [month], run `npm view [package] repository.url` and tell me if the name or source looks wrong for what it does. 5. Propose an update order, smallest risk first, with one change per commit. Then, when I approve: - Update one package or group at a time, and run the tests after each. - Never use `npm audit fix --force`. If a fix needs a major version, stop and explain what breaks. - Commit package.json and package-lock.json together. - Use `npm ci` to confirm a clean install works before saying you're finished.
- Run npm audit --omit=dev to see what reaches your live app
- Update one thing per commit, then test
- Let Dependabot open small pull requests
- Check a new package's repository and history first
- Run npm audit fix --force because the terminal suggested it
- Update everything in one commit
- Delete package-lock.json to clear an error
- Let an AI add a package unchecked
Try it now
- 1In your project folder, run
npm audit --omit=dev. Lovable users can select Scan dependencies in the Security view instead. - 2Run
npm audit fixwithout--force, then run your app and tests. If something breaks, revert the commit. - 3On GitHub, turn on the dependency graph, Dependabot alerts and security updates in your repository's Advanced Security settings. It worked when the audit is clean or each remaining finding has a reason, and Dependabot's pull requests appear for new issues.
Use it when
Monthly as a routine, right away when a vendor announces a serious flaw in something you use, and each time an AI adds a package.
Skip it when
Don't chase every warning in a development-only tool. npm audit --omit=dev shows what affects production. Don't update everything right before a launch, either. Apply only security fixes then, and leave the rest for a quiet week.
Why it works
Your app is mostly other people's code, and AI tools add packages easily. npm audit sends a description of your dependencies to the registry and reports known vulnerabilities. npm audit fix applies the fixes it can. npm's docs strongly recommend against --force unless you know what you're doing, because it can install changes beyond your declared version ranges, including major versions.
Some updates are urgent. In December 2025, Vercel began blocking new deployments of Next.js versions affected by CVE-2025-66478, and it recommended upgrading wherever you host. GitHub's Dependabot can open a pull request updating a vulnerable package to the minimum version with the patch, so each one is a small change you can test.
The lock file makes all this repeatable. npm ci installs exactly what package-lock.json says, fails if it doesn't match package.json, and never changes either file.
Example
npm audit reports a high-severity issue in a package three levels down, and suggests npm audit fix --force, which would jump your framework a major version. You ask the AI which feature depends on it. The answer: only a development tool, and npm audit --omit=dev doesn't list it. So you schedule that update instead of forcing it.
The same week, the AI suggests installing a package you don't recognize to parse dates. You run npm view <package> repository.url and find no repository. You reply: "Don't add a package for this. Use what the project already has." One less thing to keep updated.
Going further
Check package names, since AI tools can suggest ones that don't exist, or that are spelled almost like popular ones. Rule of thumb, not a vendor figure: be careful with any package that has no repository, a very recent first version or a name close to something well known. npm view connect versions shows a package's version history.
Make it automatic. npm audit --audit-level=high exits with an error only at that severity or above, so it can fail an automated build. GitHub's protected branches can require checks to pass before merging, which means a Dependabot pull request has to pass your tests. Dependabot will try to open pull requests for each open alert with a patch, so expect a burst when you first switch it on.
This mostly covers JavaScript. Other languages have their own tools, so ask the AI which one applies to your stack.
Common mistakes
- Running
npm audit fix --forcebecause the terminal suggested it. It can make major version jumps that break your app. - Updating everything in one commit. When something breaks, you can't tell which update caused it.
- Deleting
package-lock.jsonto clear an error, which can change the versions of many packages at once. - Letting an AI add a package without checking. Each one is new code you're trusting, with its own future updates.
Sources
- npm audit, npm docs
- npm ci, npm docs
- npm view, npm docs
- About Dependabot security updates, GitHub docs
- About protected branches, GitHub docs
- Vulnerable Next.js deployments blocked, Vercel changelog
- Security overview, Lovable docs
Checked 6 November 2026. Products change often, so confirm details with the vendor.