Skip to content
Snippets Groups Projects
Commit b94e5458 authored by Hutson Betts's avatar Hutson Betts Committed by Rhys Arkins
Browse files

fix(yarn): spawn in shell on Windows (#138)

Must spawn `yarn` within a shell on Windows for the `yarn`
executable to be resolved correctly. Otherwise a ENOENT
error is received because the `yarn` command can't be found.

Spawning a comamnd in a shell on Linux should behave the same,
though there may be a small increase in time required to
spawn the process.
parent 399a565f
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ async function generateLockFile(newPackageJson, npmrcContent, yarnrcContent) { ...@@ -20,7 +20,7 @@ async function generateLockFile(newPackageJson, npmrcContent, yarnrcContent) {
if (yarnrcContent) { if (yarnrcContent) {
fs.writeFileSync(path.join(tmpDir.name, '.yarnrc'), yarnrcContent); fs.writeFileSync(path.join(tmpDir.name, '.yarnrc'), yarnrcContent);
} }
cp.spawnSync('yarn', ['install'], { cwd: tmpDir.name }); cp.spawnSync('yarn', ['install'], { cwd: tmpDir.name, shell: true });
yarnLock = fs.readFileSync(path.join(tmpDir.name, 'yarn.lock')); yarnLock = fs.readFileSync(path.join(tmpDir.name, 'yarn.lock'));
} catch (error) { } catch (error) {
tmpDir.removeCallback(); tmpDir.removeCallback();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment