docs(scripts): clarify prepare script runs with --production #8822
+1
−1
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.
Description
This PR updates the documentation to clarify that the
preparelifecycle script runs on allnpm installcommands, not just those "without any arguments".Changes
--productionand other flagsnpm installFixes
Closes #4027
Context
Since npm 7, the
preparescript runs onnpm install --production, which differs from npm 6 behavior and contradicts the current documentation. This has caused confusion for users migrating from npm 6 who expected devDependencies (often required by prepare scripts) to be skipped during production installs.The documentation currently states prepare "Runs on local
npm installwithout any arguments", which is misleading. It actually runs for all install operations, including:npm install(no arguments)npm install --productionnpm install --omit=devUsers who need to skip the prepare script during production installs should use
npm install --production --ignore-scriptsas a workaround.