documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Document the meaing of `peer` in the package-lock.json documentation.

Open dwjohnston opened this issue 2 months ago • 1 comments

I am currently trying to diagnose why a package-lock.json is being changed - the behaviour appears to be different between versions 10 and 11 of npm.

On version 11 of npm I see diffs that look like this:

     "node_modules/@aws-amplify/core": {
       "version": "6.13.0",
       "license": "Apache-2.0",
+      "peer": true,
       "dependencies": {

I can not ascertain the meaning of this property.

It is not documented here:

https://docs.npmjs.com/cli/v11/configuring-npm/package-lock-json#packages

I do see this line

bin, license, engines, dependencies, optionalDependencies: fields from package.json

This seems like an incomplete list, for example I can see diffs that mention cpu and os

+    "node_modules/@parcel/watcher-android-arm64": {
       "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz",
+      "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==",
+      "cpu": [
+        "arm64"
+      ],
       "dev": true,
       "license": "MIT",
       "optional": true,
-      "dependencies": {
-        "detect-libc": "^1.0.3",
-        "is-glob": "^4.0.3",
-        "micromatch": "^4.0.5",
-        "node-addon-api": "^7.0.0"
-      },
+      "os": [
+        "android"
+      ],

However - I assume that these properties come from package.json : see: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#os

There is no such property peer on package.json - so I'm still at a loss to what it means.

dwjohnston avatar Nov 13 '25 07:11 dwjohnston

Related https://github.com/npm/cli/issues/8690#issuecomment-3463552492

riverar avatar Dec 05 '25 00:12 riverar