docs(only-allow-pnpm): added option to enforce pnpm with package.json and .npmrc #692
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
I added a non-invasive update to a single page of the docs. Currently, the docs only tell you to add
npx only-allow pnpm
to thepreinstall
script insidepackage.json
, the option—to set the.npmrc
configuration variableengine-strict
as true and specify PNPM as the enforced package manager in thepackage.json
—is not in the docs, which is why I added this option to the docs and created a pull request.How to Enforce PNPM as the Only Package Manager
For easier reference, here is one of many GitHub threads that describe the same issue:
As per the NPM docs, to prevent the use of an unspecified package manager, from Node v16.9.0 (backported to v14.19.0) onwards, you should:
.npmrc
at the root of your project..npmrc
totrue
:package.json
:npm i
ornpm i -D
, these commands return this error (before the preinstall script can run):