#1536·nunjucks

Widen chokidar peer range to ^3 || ^4 so npm 10 installs cleanly alongside modern tooling

Author: yerboogiemanCreated Aug 7, 2026Updated Aug 7, 2026

[email protected] declares:

That range was set in #1329 when chokidar was moved out of dependencies. Chokidar 4.x shipped in Oct 2024 (Node 18+, no glob support in core), and it's now what modern tools pull in — @nestjs/cli@11, @angular-devkit/core@19, @swc/cli, and fork-ts-checker-webpack-plugin all list chokidar@^4 as an optional peer.

When any of those live in the same tree as nunjucks, npm 10 fails to resolve the install:

npm 10 doesn't relax ERESOLVE for peerOptional when the versions conflict, so every user in a modern toolchain has to reach for --legacy-peer-deps or overrides — a workaround for what is really just a stale range.

Suggested fix — one-line change in package.json:

The chokidar 4 API surface used by nunjucks's FileSystemLoader (watch(), on('all', …), close()) is unchanged from 3.x, so no code changes should be needed. Happy to open a PR if that's helpful.

Repro — install nunjucks alongside any current NestJS 11 project.

Environment: nunjucks 3.2.4, npm 10.x, Node 20+.