fix: create-react-app slow behind corporate proxies #10419
+11
−3
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.
Fixes #10403. This PR speeds up
npx create-react-app
by six minutes when run behind a corporate proxy.What:
NPM has a bug where it acts really slow when run via
child_process
in an environment behind corporate proxy. Similar issues:Likely caused by sindresorhus/got#79.
With current version of CRA it takes 6 minutes additional time when
npx create-react-app
is run.Use this to test whether your environment is affected:
This command takes 3 minutes to run in such environments.
How:
There is a work-around . If
NO_UPDATE_NOTIFIER
is available as environment variablenpminternally skips some checks and moves on. Setting this variable"true"
is something I always do to my work machines - but CRA cannot expect all developers to do this manually.https://github.com/yeoman/update-notifier/blob/master/index.js#L43
This PR adds
NO_UPDATE_NOTIFIER
to thoserequire('child_process').execSync('npm ...')
calls.Link to child_process docs for busy people
Test Plan:
As this can only be reproduced when in environment behind corporate proxy this cannot be tested easily. I tested this manually in such environment. Debug logs are wrapped around these lines:
create-react-app/packages/create-react-app/createReactApp.js
Line 198 in 0f6fc2b
create-react-app/packages/create-react-app/createReactApp.js
Line 1012 in 0f6fc2b
Without the fix:
With the fix:
All comments are welcome. 👍