0

How can I check that an executable is available, on the computer my on which my NodeJS application is installed?

I don't want to wait until I call child_process.exec() to find the executable is missing, rather I would prefer to do a preflight check at the application launch, so it can fail early and clearly. I was recently bitten by this, only finding out two days after server launch, so I would like to avoid this going forward.

At the moment I am looking at simply doing which <command>, assuming a Unix based environment, and then parsing the output. Is there a better way, possibly more portable?

1 Answer 1

1

Use the which module. Always search npmjs.com and npms.io.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.