Hello im making a node app that requires: ffmpeg, node-acoutstid with fpcalc and eye3D. 
Now is my question how i can see if those 'programs' are installed on the clients machine.
whats the best way to check this ?
Use the npm list to show the installed packages in the current project as a dependency tree. Use npm list --depth=n to show the dependency tree with a specified depth. Use npm list --prod to show packages in the dependencies . Use npm list --dev to show packages in the devDependencies .
To test that you have Node. js installed correctly on your computer, open a new terminal and type node --version and you should see the current Node. js version installed.
To see if NPM is installed, type npm -v in Terminal. This should print the version number so you'll see something like this 1.4.
In macOS / Linux / bash we'd typically use type -p or command -v (or which if you're doing it wrong).
In windows there's where that you can use like where node.exe.
require('child_process').exec('type -p mything', function (err, stdout) {
  console.log(stdout);
});
This naive approach can work if you're not trying to be cross-platform compatible and if you don't have to worry about sanitizing user input.
command-exists
On npm there's a package command-exists. I peeked at the code and it looks like it's probably the simplest cross-platform detection that covers edge cases at a small size:
https://github.com/mathisonian/command-exists/blob/master/lib/command-exists.js
var commandExists = require('command-exists');
// invoked without a callback, it returns a promise
commandExists('ls').then(function (command) {
  // proceed
}).catch(function () {
  // command doesn't exist
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With