Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions docs/lib/content/configuring-npm/package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,8 @@ Unless the user has set the [`engine-strict` config](/using-npm/config#engine-st

### os

You can specify which operating systems your module will run on:
You can specify which operating systems your module will run on.
The value may be a string or an array of strings:

```json
{
Expand All @@ -1133,6 +1134,12 @@ You can specify which operating systems your module will run on:
}
```

```json
{
"os": "linux"
}
```

You can also block instead of allowing operating systems, just prepend the blocked os with a '!':

```json
Expand All @@ -1150,6 +1157,7 @@ It is allowed to both block and allow an item, although there isn't any good rea
### cpu

If your code only runs on certain cpu architectures, you can specify which ones.
Like `os`, the value may be a string or an array of strings:

```json
{
Expand All @@ -1160,6 +1168,12 @@ If your code only runs on certain cpu architectures, you can specify which ones.
}
```

```json
{
"cpu": "x64"
}
```

Like the `os` option, you can also block architectures:

```json
Expand All @@ -1175,8 +1189,20 @@ The host architecture is determined by `process.arch`

### libc

If your code only runs or builds in certain versions of libc, you can specify which ones.
This field only applies if `os` is `linux`.
If your code only runs or builds against certain libc implementations, you can specify which ones.
Like `os` and `cpu`, the value may be a string or an array of strings.
This field only applies on Linux hosts.

```json
{
"os": [
"linux"
],
"libc": [
"glibc"
]
}
```

```json
{
Expand Down