Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb2c24b

Browse files
committed
Use process.execPath to spawn node subprocess instead of requiring node to be on the system PATH.
1 parent d2f813f commit cb2c24b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-dev-utils/openBrowser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function getBrowserEnv() {
4545

4646
function executeNodeScript(scriptPath, url) {
4747
const extraArgs = process.argv.slice(2);
48-
const child = spawn('node', [scriptPath, ...extraArgs, url], {
48+
const child = spawn(process.execPath, [scriptPath, ...extraArgs, url], {
4949
stdio: 'inherit',
5050
});
5151
child.on('close', code => {

packages/react-scripts/bin/react-scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
2626

2727
if (['build', 'eject', 'start', 'test'].includes(script)) {
2828
const result = spawn.sync(
29-
'node',
29+
process.execPath,
3030
nodeArgs
3131
.concat(require.resolve('../scripts/' + script))
3232
.concat(args.slice(scriptIndex + 1)),

0 commit comments

Comments
 (0)