Skip to content

Commit 3fe28c9

Browse files
committed
Use yarnpkg alias to run Yarn
There’s a common tool included in Hadoop that also has a `yarn` command, which created issues for users who had Hadoop installed: * facebook#1257 * facebook#1363 Yarn also installs the command under `yarnpkg` alias (added in yarnpkg/yarn@cefa9a3) so we can use `yarnpkg` instead of `yarn` to make it more reliable. This has no effect on users who don't have Hadoop installed, but those who have won't see errors from falsely detecting Hadoop Yarn as Yarn the package manager, and they can now also install Yarn to make use of our Yarn support without the Hadoop Yarn interfering.
1 parent 7408e36 commit 3fe28c9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/create-react-app/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function createApp(name, verbose, version) {
138138

139139
function shouldUseYarn() {
140140
try {
141-
execSync('yarn --version', {stdio: 'ignore'});
141+
execSync('yarnpkg --version', {stdio: 'ignore'});
142142
return true;
143143
} catch (e) {
144144
return false;
@@ -149,7 +149,7 @@ function install(packageToInstall, verbose, callback) {
149149
var command;
150150
var args;
151151
if (shouldUseYarn()) {
152-
command = 'yarn';
152+
command = 'yarnpkg';
153153
args = [ 'add', '--dev', '--exact', packageToInstall];
154154
} else {
155155
command = 'npm';

packages/react-scripts/scripts/eject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ prompt(
147147
if (pathExists.sync(paths.yarnLockFile)) {
148148
console.log(cyan('Running yarn...'));
149149
fs.removeSync(ownPath);
150-
spawnSync('yarn', [], {stdio: 'inherit'});
150+
spawnSync('yarnpkg', [], {stdio: 'inherit'});
151151
} else {
152152
console.log(cyan('Running npm install...'));
153153
fs.removeSync(ownPath);

packages/react-scripts/scripts/init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
6565
var args;
6666

6767
if (useYarn) {
68-
command = 'yarn';
68+
command = 'yarnpkg';
6969
args = ['add'];
7070
} else {
7171
command = 'npm';

0 commit comments

Comments
 (0)