11cb0ef41Sopenharmony_ci# libnpmexec 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci[](https://npm.im/libnpmexec) 41cb0ef41Sopenharmony_ci[](https://npm.im/libnpmexec) 51cb0ef41Sopenharmony_ci[](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml) 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciThe `npm exec` (`npx`) Programmatic API 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci## Install 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci`npm install libnpmexec` 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci## Usage: 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci```js 161cb0ef41Sopenharmony_ciconst libexec = require('libnpmexec') 171cb0ef41Sopenharmony_ciawait libexec({ 181cb0ef41Sopenharmony_ci args: ['yosay', 'Bom dia!'], 191cb0ef41Sopenharmony_ci cache: '~/.npm/_cacache', 201cb0ef41Sopenharmony_ci npxCache: '~/.npm/_npx', 211cb0ef41Sopenharmony_ci yes: true, 221cb0ef41Sopenharmony_ci}) 231cb0ef41Sopenharmony_ci``` 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci## API: 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci### `libexec(opts)` 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci- `opts`: 301cb0ef41Sopenharmony_ci - `args`: List of pkgs to execute **Array<String>**, defaults to `[]` 311cb0ef41Sopenharmony_ci - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string. 321cb0ef41Sopenharmony_ci - `cache`: The path location to where the npm cache folder is placed **String** 331cb0ef41Sopenharmony_ci - `npxCache`: The path location to where the npx cache folder is placed **String** 341cb0ef41Sopenharmony_ci - `chalk`: Chalk instance to use for colors? **Required** 351cb0ef41Sopenharmony_ci - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found. 361cb0ef41Sopenharmony_ci - `locationMsg`: Overrides "at location" message when entering interactive mode **String** 371cb0ef41Sopenharmony_ci - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string. 381cb0ef41Sopenharmony_ci - `output`: A function to print output to **Function** 391cb0ef41Sopenharmony_ci - `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]` 401cb0ef41Sopenharmony_ci - `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.` 411cb0ef41Sopenharmony_ci - `runPath`: Location to where to execute the script **String**, defaults to `.` 421cb0ef41Sopenharmony_ci - `scriptShell`: Default shell to be used **String**, defaults to `sh` on POSIX systems, `process.env.ComSpec` OR `cmd` on Windows 431cb0ef41Sopenharmony_ci - `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean** 441cb0ef41Sopenharmony_ci - `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object** 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci## LICENSE 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci[ISC](./LICENSE) 49