docs: add libc option to package.json documentation (#1256)
This has been implemented in https://github.com/npm/npm-install-checks/pull/54, but it seems to have never been documented.
Jonas committed
Sep 3, 2024 at 10:13 UTC
bc684678143b4a80899bd9715e0aa50b11e7d8ef
1 file changed
+20
content/cli/v10/configuring-npm/package-json.mdx
+20
@@ -905,6 +905,26 @@ Like the `os` option, you can also block architectures:
905
906
The host architecture is determined by `process.arch`
907
908
+### libc
909
+
910
+If your package only supports certain libc implementations, you can specify which ones. When running on non-Linux systems, any specified value for libc will fail the check.
911
+
912
+```json
913
+{
914
+ "libc": ["glibc", "musl"]
915
+}
916
+```
917
+
918
+Similarly as with `os` and `cpu`, you can also block certain libc implementations:
919
+
920
+```json
921
+{
922
+ "libc": ["!glibc"]
923
+}
924
+```
925
+
926
+Libc implementations is inferred by inspecting `process.report.glibcVersionRuntime` in the case of glibc or `process.report.sharedObjects` in the case of musl.
927
+
928
### private
929
930
If you set `"private": true` in your package.json, then npm will refuse to publish it.