8000 spawn ENOENT in GitHub Actions · Issue #544 · sindresorhus/execa · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

spawn ENOENT in GitHub Actions #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timheerwagen opened this issue Mar 9, 2023 · 6 comments
Closed

spawn ENOENT in GitHub Actions #544

timheerwagen opened this issue Mar 9, 2023 · 6 comments

Comments

@timheerwagen
Copy link

When i start a node package with npx in a github action, in which an execa command is executed, and then get the following error message directly when I try to start this command: spawn turbo run build --scope=admin ENOENT or spawn npx turbo run build --scope=admin ENOENT. On local everything works.

Apparently it cannot find the spawn command.

I have found the following workaround, which is to add {shell: true} to the execa command. But I don't like this for reasons that are obviously shown in the documentation.

shell

We recommend against using this option since it is:

- not cross-platform, encouraging shell-specific syntax.
- slower, because of the additional shell interpretation.
- unsafe, potentially allowing command injection.
@ehmicky
Copy link
Collaborator
ehmicky commented Mar 9, 2023

Hi @timheerwagen,

If turbo is installed locally, you might be able to run it directly using the preferLocal: true option. Without it, your local node_modules might be absent from the PATH, depending on the environment. You would also need to run it without using npx, since it would be unnecessary there and might interfere in the command spawning.

Can you try with that option enabled and without npx, and see whether his works?

@timheerwagen
Copy link
Author

I tried it with preferLocal, whether with or without NPX, the error output remains the same.

@ehmicky
Copy link
Collaborator
ehmicky commented Mar 10, 2023

This is a complex setup: GitHub action + turbo + Execa.
To be able to help any further, would you be able to create a reproduction repository? Thanks.

@timheerwagen
Copy link
Author

I have now created a minimal reproduction and I am encountering the same error.
https://github.com/timheerwagen/execa_minimal_repro/actions/runs/4386540059/jobs/7680727034

@ehmicky
Copy link
Collaborator
ehmicky commented Mar 10, 2023

Thanks!
This code is calling execa('npx turbo run build --scope=admin'). The correct syntax is execa('npx', ['turbo', 'run', 'build', '--scope=admin']). Link to documentation and example.

If you want to pass both the file and arguments as a single string, execaCommand() is also available.

@timheerwagen
Copy link
Author

Thank you for your help, I must have overlooked that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0