Skip to content

Commit

Permalink
Use yarnpkg alias to run Yarn (#1365)
Browse files Browse the repository at this point in the history
There’s a common tool included in Hadoop that also has a `yarn` command,
which created issues for users who had Hadoop installed:
* #1257
* #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.
  • Loading branch information
fson committed Jan 9, 2017
1 parent 96f4be9 commit 24abc5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function createApp(name, verbose, version) {

function shouldUseYarn() {
try {
execSync('yarn --version', {stdio: 'ignore'});
execSync('yarnpkg --version', {stdio: 'ignore'});
return true;
} catch (e) {
return false;
Expand All @@ -149,7 +149,7 @@ function install(packageToInstall, verbose, callback) {
var command;
var args;
if (shouldUseYarn()) {
command = 'yarn';
command = 'yarnpkg';
args = [ 'add', '--dev', '--exact', packageToInstall];
} else {
command = 'npm';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ prompt(
if (pathExists.sync(paths.yarnLockFile)) {
console.log(cyan('Running yarn...'));
fs.removeSync(ownPath);
spawnSync('yarn', [], {stdio: 'inherit'});
spawnSync('yarnpkg', [], {stdio: 'inherit'});
} else {
console.log(cyan('Running npm install...'));
fs.removeSync(ownPath);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
var args;

if (useYarn) {
command = 'yarn';
command = 'yarnpkg';
args = ['add'];
} else {
command = 'npm';
Expand Down

0 comments on commit 24abc5e

Please sign in to comment.