npm warns that an old uuid version is deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher.Short answer
The warning comes from the package's own deprecation notice for an old uuid release. It is usually a dependency of a dependency, not your code. Run npm explain uuid to see who asks for it, update that parent, or force a newer uuid with an overrides entry in your root package.json.
Fix it fast
1Find out which cause you have
Print the chain of packages that causes this copy of uuid to be installed.
npm explain uuid2Match what you see, then jump to its fix
- 1
npm explain shows uuid@3.x under a package you did not add yourselfA transitive dependency still asks for the old uuidFix - 2
package.json lists uuid with a version of 3.xYour own project depends directly on the old uuidFix - 3
The parent is the latest release and still asks for the old uuidA parent package cannot be updated yetFix
- 1
What does the error look like?
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher.npm warn deprecated uuid@3.4.0
Cause 1 of 3
A transitive dependency still asks for the old uuid
1Check
npm explain prints the dependency chain for every installed copy of a package, up to your root project.
npm explain uuid
npm outdated2Fix
Update the package at the top of that chain to a release that has moved on from the old uuid. If you cannot, ask its maintainers, then use the overrides fix below.
npm install <parent-package>@latest3Verify
Run npm explain uuid again; the old copy is gone from the chain.
npm explain uuidConfirmed by docs.npmjs.com
Cause 2 of 3
Your own project depends directly on the old uuid
1Check
Look at the range you declared.
grep -n '"uuid"' package.json2Fix
Install the current version and use the named export. Note that from uuid 12 onward CommonJS is no longer supported, so require() code needs ESM imports or an earlier major.
npm install uuid@latest
// in code
import { v4 as uuidv4 } from 'uuid';
const id = uuidv4();3Verify
Run your tests and confirm that the warning does not show on a clean install.
rm -rf node_modules
npm installConfirmed by github.com
Cause 3 of 3
A parent package cannot be updated yet
1Check
Overrides replace a package anywhere in the dependency tree. They are only read from the root package.json.
grep -n -A4 '"overrides"' package.json2Fix
Add an overrides entry with a semver range for a newer uuid, then reinstall. Test the parent package afterwards, since it was written against the old API.
{
"overrides": {
"uuid": "^9.0.0"
}
}3Verify
A fresh install no longer prints the deprecation notice.
rm -rf node_modules package-lock.json
npm installConfirmed by docs.npmjs.com
How do I stop it coming back?
- Run npm outdated now and then, and update the packages that sit at the top of the warnings.
- Read npm explain before you reach for an override, because the real fix is usually a parent update.
- Run your tests after adding any override.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix