Skip to content

Commit

Permalink
Use yarnpkg alias to run Yarn (facebook#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:
* 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.
  • Loading branch information
fson authored and alexdriaguine committed Jan 23, 2017
1 parent d8a0275 commit e589992
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 @@ -135,7 +135,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 @@ -146,7 +146,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 @@ -146,7 +146,7 @@ prompt(
if (fs.existsSync(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 @@ -64,7 +64,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 e589992

Please sign in to comment.