-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop yarn error message appearing for Windows users of local-cli #13355
Conversation
@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
@hramos thanks for importing! OSS tests are passing, and it looks like it can still be rebased on top of master. Are you able to tell me what failed on the import? (cc @ericvicenti as oncall) |
Looks like a flaky internal test has been blocking it. Giving it another try. |
Summary: On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, expo/create-react-native-app#101, expo/create-react-native-app#113 (comment) for examples of users hitting this in the wild), even though no package management action is being taken. From what I can tell this is what happens: * [`local-cli/util/yarn.js` does not ignore stderr on Windows](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/yarn.js#L25) * [`local-cli/util/PackageManager.js` calls the above function when it's require'd](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/PackageManager.js#L20) For Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays wh Closes #13355 Differential Revision: D4848084 Pulled By: hramos fbshipit-source-id: f32176354e0bd7ff6d7009ea30dca64ff23ae3d5
Summary: On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, expo/create-react-native-app#101, expo/create-react-native-app#113 (comment) for examples of users hitting this in the wild), even though no package management action is being taken. From what I can tell this is what happens: * [`local-cli/util/yarn.js` does not ignore stderr on Windows](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/yarn.js#L25) * [`local-cli/util/PackageManager.js` calls the above function when it's require'd](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/PackageManager.js#L20) For Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays wh Closes #13355 Differential Revision: D4848084 Pulled By: hramos fbshipit-source-id: f32176354e0bd7ff6d7009ea30dca64ff23ae3d5
Summary: On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, expo/create-react-native-app#101, expo/create-react-native-app#113 (comment) for examples of users hitting this in the wild), even though no package management action is being taken. From what I can tell this is what happens: * [`local-cli/util/yarn.js` does not ignore stderr on Windows](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/yarn.js#L25) * [`local-cli/util/PackageManager.js` calls the above function when it's require'd](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/PackageManager.js#L20) For Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays wh Closes facebook#13355 Differential Revision: D4848084 Pulled By: hramos fbshipit-source-id: f32176354e0bd7ff6d7009ea30dca64ff23ae3d5
Summary: On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, expo/create-react-native-app#101, expo/create-react-native-app#113 (comment) for examples of users hitting this in the wild), even though no package management action is being taken. From what I can tell this is what happens: * [`local-cli/util/yarn.js` does not ignore stderr on Windows](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/yarn.js#L25) * [`local-cli/util/PackageManager.js` calls the above function when it's require'd](https://github.com/facebook/react-native/blob/6fa87134fc68fd447e33a01a538ae0af6710e5d2/local-cli/util/PackageManager.js#L20) For Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays wh Closes facebook/react-native#13355 Differential Revision: D4848084 Pulled By: hramos fbshipit-source-id: f32176354e0bd7ff6d7009ea30dca64ff23ae3d5
Motivation
On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, expo/create-react-native-app#101, expo/create-react-native-app#113 (comment) for examples of users hitting this in the wild), even though no package management action is being taken.
From what I can tell this is what happens:
local-cli/util/yarn.js
does not ignore stderr on Windowslocal-cli/util/PackageManager.js
calls the above function when it's require'dFor Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays whenever local-cli requires PackageManager.js (which appears to be most of the time?).
Further, as far as I can tell there's no need to have this shell invocation happen when the module is loaded. It can be deferred to run only when we actually need to determine whether to use npm or yarn.
Test Plan
I've manually tested that the yarnVersion assignment behaves correctly on Mac and Windows, with yarn available and without. This doesn't seem like a clear opportunity for a regression test, as it's a small cosmetic problem.