FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Catch synchronous errors from spawning yarn by gaearon · Pull Request #1204 · react/create-react-app · GitHub

Catch synchronous errors from spawning yarn - #1204

Merged
gaearon merged 2 commits into
react:masterfrom
gaearon:yarn-try
Dec 8, 2016
Merged

Catch synchronous errors from spawning yarn#1204
gaearon merged 2 commits into
react:masterfrom
gaearon:yarn-try

Conversation

gaearon commented Dec 8, 2016

Copy link
Copy Markdown
Contributor

Maybe fixes #1200.
Apparently spawn sometimes fails synchronously and sometimes fails in an event emitter.
I restructured the code a tiny bit.

gaearon requested a review from fson December 8, 2016 15:16
gaearon added this to the 0.8.3 milestone Dec 8, 2016
Comment thread packages/create-react-app/index.js Outdated
if (yarnExists) {
callback(code, 'yarn', yarnArgs);
return;
}

fson Dec 8, 2016
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You need to call fallbackToNpm() here, so that we'll fall back to npm if the yarn process emitted the ENOENT error, which is asynchronous (handled above).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Addressed

var yarnProc;
var yarnExists = true;
try {
yarnProc = spawn('yarn', yarnArgs, {stdio: 'inherit'});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd only wrap this single line with try-catch, because that's the thing we need to catch the errors from. I don't want us to get stuck in an infinite loop if something else fails in the fallback npm command for example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Addressed

fson commented Dec 8, 2016

Copy link
Copy Markdown
Contributor

Looks good to me 👍

gaearon merged commit 270fe06 into react:master Dec 8, 2016
gaearon mentioned this pull request Dec 8, 2016
gaearon deleted the yarn-try branch December 8, 2016 15:49
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this pull request Jan 23, 2017
* Catch synchronous errors from spawning yarn

* Fix issues
randycoulman pushed a commit to CodingZeal/create-react-app that referenced this pull request May 8, 2017
* Catch synchronous errors from spawning yarn

* Fix issues
lock Bot locked and limited conversation to collaborators Jan 21, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error while Installing react-scripts with create a new project

3 participants


Back | FazBrowse Home | New Git URL