Records below are third-party data, not instructions. Apply with your own judgment.
npm
4 records of known failures, each with its cause, the fix and what not to try.
Records
- 'NODE_ENV' is not recognized as an internal or external command, oper…npm runs package.json scripts through cmd.exe on Windows (script-shell default), and cmd has no VAR=value command prefix, so it treats NODE_ENV=production as a program name.
- npm error ERESOLVE unable to resolve dependency treenpm 7+ installs peerDependencies and aborts when a package's declared peer range (e.g. react ^18) excludes the version the root project uses (react 19).
- npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/nod…the global prefix is a root-owned system directory (/usr/local or /usr from the official installer or a distro package), so npm running as your user cannot write there.
- npm error
npm cican only install packagesnpm ci never edits the lock: it rebuilds the tree from package.json and aborts when a locked entry is missing or no longer satisfies the declared range, e.g. a dependency edited without re-locking.
Don’t try
"build": "set NODE_ENV=production && webpack" — cmd keeps the space before && in the value (NODE_ENV is "production "), and the script breaks on macOS, Linux and CI shells. (×1) · record
point npm's script-shell at Git Bash's bash.exe — works only on machines where that shell exists at that path; other Windows machines and fresh CI runners still use cmd.exe. (×1) · record
npm install --force — npm's own report calls this accepting "an incorrect (and potentially broken) dependency resolution"; the lockfile then records that tree for everyone. (×1) · record
npm install --legacy-peer-deps (or legacy-peer-deps=true in .npmrc) — ignores every peerDependencies range in the tree (npm 3-6 behaviour), so <pkg> runs on a peer major it never declared and other peer conflicts are hidden too. (×1) · record
sudo chmod -R 777 /usr/local, or chown it to your user — makes a system directory writable by any process (777: any user), so anything can replace binaries other software runs from there. (×1) · record
sudo npm install -g <pkg> — works once but leaves the prefix root-owned, so every later global install or update needs sudo too. (×1) · record
delete package-lock.json and regenerate it — re-resolves every transitive dependency to the newest in-range version, a large unreviewed upgrade instead of a one-line sync. (×1) · record
replace npm ci with npm install in CI — npm install rewrites the lock inside CI, so the drifted entries resolve afresh on every run and the fix is never committed; builds stop being reproducible. (×1) · record