Open gitLinda opened 1 year ago
Same error on windows: https://github.com/khalilou88/jnxplus/actions/runs/6727510978/job/18285417595
Let's consider these scripts:
log.js
#!/usr/bin/env node
console.log("log.js");
test.js
const { execFileSync } = require('child_process');
const cmd = 'C:\\pathto\\log.js'; //on ubuntu '/pathto/log.js'
execFileSync(cmd, {stdio: 'inherit'});
if you run the test.js in Windows you will get this error: Error: spawnSync C:\pathto\log.js UNKNOWN
if you run the test.js on Unix-like platforms it will run You can read about the shebang-line here: https://stackoverflow.com/a/33510581
You can't run a js file like this with execFileSync in windows. For a workaround, I think this can be done
execFileSync(
nx,
['run-many', '--targets', 'publish', '--ver', '0.0.0-e2e', '--tag', 'e2e'],
{ env: process.env, stdio: 'inherit', shell: true }
);
or
execFile(
`${nx} run-many --targets publish --ver 0.0.0-e2e --tag e2e`
);
I think a wrapper batch script is missing.
This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏
Current Behavior
When adding plugin e2e tests with the e2eProjectGenerator, a start-local-registry.ts is generated. When I run the e2e target of my-plugin-e2e, which executes the start-local-registry.ts script, I get the following error:
Jest: Got error running globalSetup - C:\Users\lkrue\develop\temp\jose\tools\scripts\start-local-registry.ts, reason: spawnSync C:\Users\lkrue\develop\temp\jose\node_modules\.pnpm\nx@16.10.0_@swc-node+register@1.6.8_@swc+core@1.3.93\node_modules\nx\bin\nx.js UNKNOWN
I checked the path in the node modules, and it's there. Also the
const nx = require.resolve('nx')
line is fine. The error happens when executingexecFileSync( nx, ['run-many', '--targets', 'publish', '--ver', '1.0.0', '--tag', 'e2e'], { env: process.env, stdio: 'inherit' } );
It seems to be a windows problem. Since it is running fine on Mac.
Expected Behavior
The e2e tests can be executed
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response