Files
Zoltan KochanandClaude Opus 5.5 c13953b3bc docs: label shell commands and title file snippets (#16699)
Code blocks that hold only shell commands now use the `sh` language,
and blocks showing a file's contents carry a `title` naming the file,
across the pnpm v12, pnpm v11, and pnpr docs. Bold file-name labels
above code blocks are folded into the titles.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:14:37 +02:00

32 lines
1.0 KiB
Plaintext

### shellEmulator
* Default: **false**
* Type: **Boolean**
When `true`, pnpm will use a JavaScript implementation of a [bash-like shell] to
execute scripts.
This option simplifies cross-platform scripting. For instance, by default, the
next script will fail on non-POSIX-compliant systems:
```json title="package.json"
"scripts": {
"test": "NODE_ENV=test node test.js"
}
```
But if the `shellEmulator` setting is set to `true`, it will work on all
platforms.
Since v11.28.1, a configured non-empty `scriptShell` wins over `shellEmulator`
for `pnpm run` and lifecycle scripts. The emulator runs only when `scriptShell`
is unset or empty.
:::note
Node.js 22 or higher supports running scripts without pnpm's assistance. For the example above, you can run the `test` script with `node --run test`. However, the `shellEmulator` option has no effect on this. Scripts that depend on POSIX features are required to be run `pnpm run` instead of `node --run` to work in non-POSIX-compliant environments.
:::
[bash-like shell]: https://www.npmjs.com/package/@yarnpkg/shell