JSPM

require-native-executable

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q67333F
  • License Apache-2.0

Small utility ot check if a native executable exists, and if not, print an error message

Package Exports

  • require-native-executable

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (require-native-executable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

require-native-executable

NodeJS startup check utility that ensures a native executables exists and else fails.

Sync require

We recommend that you place this code in your module after your require() statements.

const {requireNativeExecutableSync} = require("require-native-executable");

// Each of those will throw if the executable is not present
requireNativeExecutableSync('bash');
requireNativeExecutableSync('java');

The generated error will be a NativeExecutableMissingError and look like this:

The native executable 'java' was not found on your system but is required to load this application.

Use err.exeName to get the name of the missing executable

Async require

const {requireNativeExecutable} = require("require-native-executable");

// Will
requireNativeExecutable('java').then(() => {
    // Executable exists
}).catch(err => {
    // err will be a NativeExecutableMissingError, see above for an example.
});