Skip to content

npm 12 - drops npm-shrinkwrap.json #1117

Description

@MikeMcC399

Situation

npm 12 drops npm-shrinkwrap.json used in this repo as a published lockfile. The npm 12.0.0 changelog states:

npm shrinkwrap is removed, the shrinkwrap config alias is removed, and npm-shrinkwrap.json is no longer loaded or honored at the project root or from inside dependency tarballs. Rename project-root npm-shrinkwrap.json to package-lock.json; use bundleDependencies if you need to ship a locked dependency tree.

npm install under npm 12 installs dependencies according to their SemVer range specified in package.json and ignores the lower locked versions specified in npm-shrinkwrap.json.

Example impact

If the repo is cloned and dependencies installed under npm 12, then npm test fails.

npm install ignores the locked prettier@3.6.2 and installs instead prettier@^3.6.2 from package.json which causes prettier@3.9.6 to be installed, and written into the new lockfile package-lock.json.

prettier@3.9.0 introduced formatting improvements which flagged a white space formatting issue in lib/reporter/logger.js that was not previously flagged.

Steps to reproduce

Ubuntu 24.04.4 LTS, Node.js 24.19.0, initially with npm 11.17.0

git clone https://github.com/nodejs/citgm
cd citgm
git clean -xfd # if repeating
npm install -g npm@12.0.2
npm install
npm test

Logs

$ npm test
npm notice run citgm@10.0.2 test
npm notice run npm run lint && npm run tap
npm notice run citgm@10.0.2 lint
npm notice run npm run lint:eslint && npm run lint:prettier
npm notice run citgm@10.0.2 lint:eslint
npm notice run eslint . --cache
npm notice run citgm@10.0.2 lint:prettier
npm notice run prettier --check .
Checking formatting...
[warn] lib/reporter/logger.js
[warn] Code style issues found in the above file. Run Prettier with --write to fix.

Suggestion

Review also how this impacts use of citgm when installing using npm install -g citgm as specified in the README > Installation section.

For the Prettier issue, that was used here more as an illustration of compatibility issues, update to latest and fix the formatting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions