Skip to content

Commit

Permalink
fix: setup_env script failure (#182)
Browse files Browse the repository at this point in the history
* fix: setup_env script failure

* chore: adjust the message and remove unused windows script

* fix: adjust platform check and wording

* chore: remove dot for continuity with error
  • Loading branch information
thymikee authored Feb 22, 2019
1 parent 0b12618 commit bd332b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
4 changes: 0 additions & 4 deletions packages/cli/setup_env.bat

This file was deleted.

23 changes: 18 additions & 5 deletions packages/cli/src/cliEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,24 @@ async function run() {
}

async function setupAndRun() {
const setupEnvScript = /^win/.test(process.platform)
? path.join('..', 'setup_env.bat')
: path.join('..', 'setup_env.sh');

childProcess.execFileSync(path.join(__dirname, setupEnvScript));
// We only have a setup script for UNIX envs currently
if (process.platform !== 'win32') {
const scriptName = 'setup_env.sh';
const absolutePath = path.join(__dirname, '..', scriptName);

try {
childProcess.execFileSync(absolutePath, { stdio: 'pipe' });
} catch (error) {
logger.warn(
`Failed to run environment setup script "${scriptName}"\n\n${chalk.red(
error
)}`
);
logger.info(
`React Native CLI will continue to run if your local environment matches what React Native expects. If it does fail, check out "${absolutePath}" and adjust your environment to match it.`
);
}
}

/**
* Read passed `options` and take the "global" settings
Expand Down

0 comments on commit bd332b3

Please sign in to comment.