1 # npm-run-path [![Build Status](https://travis-ci.org/sindresorhus/npm-run-path.svg?branch=master)](https://travis-ci.org/sindresorhus/npm-run-path)
3 > Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
5 In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm.
11 $ npm install --save npm-run-path
18 const childProcess = require('child_process');
19 const npmRunPath = require('npm-run-path');
21 console.log(process.env.PATH);
24 console.log(npmRunPath());
25 //=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
27 // `foo` is a locally installed binary
28 childProcess.execFileSync('foo', {
36 ### npmRunPath([options])
43 Default: `process.cwd()`
50 Default: [`PATH`](https://github.com/sindresorhus/path-key)
52 PATH to be appended.<br>
53 Set it to an empty string to exclude the default PATH.
55 ### npmRunPath.env([options])
62 Default: `process.cwd()`
70 Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
75 - [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
76 - [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
81 MIT © [Sindre Sorhus](https://sindresorhus.com)