Closed cimak closed 7 months ago
I have two versions of node installed:
> nvm use 21 Now using node v21.2.0 (npm v10.2.3) > node --version v21.2.0
If I now run backstop remote, it will execute super-simple-web-server script with node v10.19.0 :
backstop remote
super-simple-web-server
> backstop remote --config="backstop.config.cjs" BackstopJS v6.2.2 Loading config: /mnt/c/projects/[...]/backstop.config.cjs COMMAND | Executing core for "remote" remote | Starting remote with: node /mnt/c/projects/[...]/node_modules/super-simple-web-server/index.js [...] ^ this runs v10.19.0 from /usr/bin
and that's a problem because v10 does not support optional chaining, so I'm getting Unexpected token . errors in runPuppet.js.
Unexpected token .
runPuppet.js
Looking at backstopjs\core\command\remote.js, I think the problem is caused by calling exec with narrowed env:
backstopjs\core\command\remote.js
exec
const commandStr = `node ${ssws} ${projectPath} ${MIDDLEWARE_PATH} --config=${config.backstopConfigFileName}`; const env = {'SSWS_HTTP_PORT': port }; // no PATH passed? [...] const child = exec(commandStr, {env: env});
changing:
const env = {'SSWS_HTTP_PORT': port };
to:
const env = {'SSWS_HTTP_PORT': port, ...process.env};
seems to be solving the problem.
Duplicate of #1488
I have two versions of node installed:
Problem
If I now run
backstop remote
, it will executesuper-simple-web-server
script with node v10.19.0 :and that's a problem because v10 does not support optional chaining, so I'm getting
Unexpected token .
errors inrunPuppet.js
.Cause
Looking at
backstopjs\core\command\remote.js
, I think the problem is caused by callingexec
with narrowed env:Solution?
changing:
to:
seems to be solving the problem.