{"_id":"npm-path","_rev":"120074","name":"npm-path","description":"Get a PATH with all executables available to npm scripts.","dist-tags":{"latest":"2.0.4"},"maintainers":[{"name":"timoxley","email":""}],"time":{"modified":"2021-06-03T10:55:52.000Z","created":"2014-04-20T23:11:25.218Z","2.0.4":"2018-01-06T09:02:26.237Z","2.0.3":"2016-12-14T00:02:03.574Z","2.0.2":"2016-07-22T06:55:17.902Z","2.0.1":"2016-07-22T05:19:44.759Z","2.0.0":"2016-07-22T05:13:26.084Z","1.1.0":"2016-02-16T03:12:37.661Z","1.0.2":"2015-06-10T18:43:20.384Z","1.0.1":"2014-06-23T04:20:58.125Z","1.0.0":"2014-04-20T23:11:25.218Z"},"users":{"zeke":true,"garthk":true,"axelrindle":true,"krkahl":true},"author":{"name":"Tim Oxley"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"versions":{"2.0.4":{"name":"npm-path","version":"2.0.4","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"clean":"rimraf build-test && (rm *.js || true)","prebuild":"npm run clean","build":"babel src --out-dir . && babel test --out-dir build-test","prepublish":"not-in-publish || npm run build","tests-only":"tape build-test -r airbnb-js-shims | faucet","pretest":"standard src/* test/* bin/*","test":"npm run build && npm run tests-only"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=0.8"},"devDependencies":{"airbnb-js-shims":"^1.4.0","babel-cli":"^6.26.0","babel-preset-airbnb":"^2.4.0","babel-register":"^6.26.0","faucet":"0.0.1","in-publish":"^2.0.0","npm":"^3.10.10","rimraf":"^2.6.2","standard":"^7.1.2","tape":"^4.8.0"},"dependencies":{"which":"^1.2.10"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"71ba97c8d4129cb335d1d66aeb05526829f62372","_id":"npm-path@2.0.4","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"dist":{"shasum":"c641347a5ff9d6a09e4d9bce5580c4f505278e64","size":8119,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-2.0.4.tgz"},"maintainers":[{"name":"timoxley","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/npm-path-2.0.4.tgz_1515229346160_0.10402124701067805"},"publish_time":1515229346237,"_hasShrinkwrap":false,"_cnpm_publish_time":1515229346237},"2.0.3":{"name":"npm-path","version":"2.0.3","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet && standard *.js test/*.js bin/*.js"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=4.2.0"},"devDependencies":{"faucet":"0.0.1","npm":"^3.10.5","standard":"^7.1.2","tape":"^4.6.0"},"dependencies":{"which":"^1.2.10"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"1fc4d0913921eab480a438acb6cacf18212fa51e","_id":"npm-path@2.0.3","_shasum":"15cff4e1c89a38da77f56f6055b24f975dfb2bbe","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"dist":{"shasum":"15cff4e1c89a38da77f56f6055b24f975dfb2bbe","size":6231,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-2.0.3.tgz"},"maintainers":[{"name":"timoxley","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/npm-path-2.0.3.tgz_1481673723327_0.30345648783259094"},"publish_time":1481673723574,"_cnpm_publish_time":1481673723574,"_hasShrinkwrap":false},"2.0.2":{"name":"npm-path","version":"2.0.2","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet && standard *.js test/*.js bin/*.js"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=4.2.0"},"devDependencies":{"faucet":"0.0.1","npm":"^3.10.5","standard":"^7.1.2","tape":"^4.6.0"},"dependencies":{"which":"^1.2.10"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"f9248253470abd003d3898a8b7b69ede3426d30d","_id":"npm-path@2.0.2","_shasum":"6462f098bb38e21e335a8c6f42d21d7b57f098c8","_from":".","_npmVersion":"3.10.5","_nodeVersion":"6.2.2","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"6462f098bb38e21e335a8c6f42d21d7b57f098c8","size":6059,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-2.0.2.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/npm-path-2.0.2.tgz_1469170514865_0.36801144178025424"},"publish_time":1469170517902,"_cnpm_publish_time":1469170517902,"_hasShrinkwrap":false},"2.0.1":{"name":"npm-path","version":"2.0.1","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet && standard *.js test/*.js bin/*.js"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=4.2.0"},"devDependencies":{"faucet":"0.0.1","npm":"^3.10.5","standard":"^7.1.2","tape":"^4.6.0"},"dependencies":{"which":"^1.2.10"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"6a8ea2a3dbdf35ab6fb46cbd90b31b9763aa9f53","_id":"npm-path@2.0.1","_shasum":"834ead081de1ab1e2cc84f2379ac5dc014a76ee9","_from":".","_npmVersion":"3.10.5","_nodeVersion":"6.2.2","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"834ead081de1ab1e2cc84f2379ac5dc014a76ee9","size":6062,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-2.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/npm-path-2.0.1.tgz_1469164784519_0.8126495121978223"},"publish_time":1469164784759,"_cnpm_publish_time":1469164784759,"_hasShrinkwrap":false},"2.0.0":{"name":"npm-path","version":"2.0.0","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet && standard *.js test/*.js bin/*.js"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=4.4.5"},"devDependencies":{"faucet":"0.0.1","npm":"^3.10.5","standard":"^7.1.2","tape":"^4.6.0"},"dependencies":{"which":"^1.2.10"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"20c7c84ff84acbefdddb4821a23ddf18f9857958","_id":"npm-path@2.0.0","_shasum":"13d389363a2377b7d054f1be206eed0b90f5c72f","_from":".","_npmVersion":"3.10.5","_nodeVersion":"6.2.2","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"13d389363a2377b7d054f1be206eed0b90f5c72f","size":6069,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/npm-path-2.0.0.tgz_1469164402963_0.8452480351552367"},"publish_time":1469164406084,"_cnpm_publish_time":1469164406084,"_hasShrinkwrap":false},"1.1.0":{"name":"npm-path","version":"1.1.0","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet"},"author":{"name":"Tim Oxley"},"license":"MIT","devDependencies":{"faucet":"0.0.1","npm":"^3.7.2","tape":"^4.4.0"},"dependencies":{"which":"^1.2.4"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"e1e9acac92fe51f9a86076ae975b03f7d9d9cee0","_id":"npm-path@1.1.0","_shasum":"0474ae00419c327d54701b7cf2cd05dc88be1140","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"0474ae00419c327d54701b7cf2cd05dc88be1140","size":5839,"noattachment":false,"key":"/npm-path/-/npm-path-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/npm-path-1.1.0.tgz_1455592355776_0.19419350288808346"},"publish_time":1455592357661,"_cnpm_publish_time":1455592357661,"_hasShrinkwrap":false},"1.0.2":{"name":"npm-path","version":"1.0.2","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet"},"author":{"name":"Tim Oxley"},"license":"MIT","devDependencies":{"faucet":"0.0.1","tape":"^4.0.0"},"dependencies":{"which":"^1.1.1"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"cf614414bdde419842028dbdbd9e8d404e964a6b","_id":"npm-path@1.0.2","_shasum":"e7f6ecf5e51f8ef972cbaa3b2c29cebc2d69a870","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"e7f6ecf5e51f8ef972cbaa3b2c29cebc2d69a870","size":4799,"noattachment":false,"key":"/npm-path/-/npm-path-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-1.0.2.tgz"},"publish_time":1433961800384,"_cnpm_publish_time":1433961800384,"_hasShrinkwrap":false},"1.0.1":{"name":"npm-path","version":"1.0.1","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet"},"author":{"name":"Tim Oxley"},"license":"MIT","devDependencies":{"faucet":"0.0.1","tape":"^2.12.3"},"dependencies":{"which":"^1.0.5"},"directories":{"test":"test"},"repository":{"type":"git","url":"https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"ee9113d47b1d0ee27cefb94d9e40a160708d3ed4","_id":"npm-path@1.0.1","_shasum":"15d750efc9d8808194c721481dfa210fbde415c5","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"dist":{"shasum":"15d750efc9d8808194c721481dfa210fbde415c5","size":4796,"noattachment":false,"key":"/npm-path/-/npm-path-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-1.0.1.tgz"},"publish_time":1403497258125,"_cnpm_publish_time":1403497258125,"_hasShrinkwrap":false},"1.0.0":{"name":"npm-path","version":"1.0.0","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet"},"author":{"name":"Tim Oxley"},"license":"MIT","devDependencies":{"faucet":"0.0.1","tape":"^2.12.3"},"dependencies":{"which":"^1.0.5"},"_id":"npm-path@1.0.0","dist":{"shasum":"3910f4a49eec072f3dad60eb4e27edda652acac8","size":4665,"noattachment":false,"key":"/npm-path/-/npm-path-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/npm-path/download/npm-path-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":""}],"directories":{},"publish_time":1398035485218,"_cnpm_publish_time":1398035485218,"_hasShrinkwrap":false}},"readme":"# npm-path\n\n### Get a PATH containing locally installed module executables.\n\n`npm-path` will get you a PATH with all of the executables available to npm scripts, without booting up all of npm(1).\n\n#### `npm-path` will set your PATH to include:\n\n* All of the `node_modules/.bin` directories from the current directory, up through all of its parents. This allows you to invoke the executables for any installed modules. e.g. if `mocha` is installed a dependency of the current module, then `mocha` will be available on a `npm-path` generated `$PATH`.\n* The directory containing the current `node` executable, so any scripts that invoke `node` will execute the same `node`.\n* Current npm's `node-gyp` directory, so the `node-gyp` bundled with `npm` can be used.\n\n## Usage\n\n### Command-line\n\n```bash\n# Prints the augmented PATH to the console\n> npm-path\n# /usr/local/lib/node_modules/npm/bin/node-gyp-bin:.../node_modules/.bin:/.../usr/local/bin:/usr/local/sbin: ... etc\n```\n\nCalling `npm-path` from the commandline is the equivalent of executing an npm script with the body `echo $PATH`, but without all of the overhead of booting or depending on `npm`.\n\n### Set PATH\n\nThis will set the augmented PATH for the current process environment, or an environment you supply.\n\n```js\nvar npmPath = require('npm-path')\nvar PATH = npmPath.PATH // get platform independent PATH key\n\nnpmPath(function(err, $PATH) {\n  \n  // Note: current environment is modified!\n  console.log(process.env[PATH] == $PATH) // true\n  \n  console.log($PATH)\n  // /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/.../.bin:/usr/local/bin: ...etc\n  \n})\n\n// more explicit alternative syntax\nnpmPath.set(function(err, $PATH) {\n  // ...\n})\n```\n\n#### Synchronous Alternative\n\n```js\n\n//  supplying no callback will execute method synchronously\nvar $PATH = npmPath()\nconsole.log($PATH)\n\n// more explicit alternative syntax\n$PATH = npmPath.setSync()\n```\n\n#### Optional Options\n\n```js\nvar options = {\n  env: process.env, // default.\n  cwd: process.cwd() // default.\n}\n\nnpmPath(options, function(err, $PATH) {\n  // ...\n})\n\nnpmPath.setSync(options)\n\n  // ...\n\n```\n\n\n### Get PATH\n\nThis will get npm augmented PATH, but *does not modify the PATH in the environment*.\nTakes the exact same options as `set`.\n\n```js\nnpmPath.get(function(err, $PATH) {\n  console.log($PATH)\n  \n  // Note: current environment is NOT modified!\n  console.log(process.env[PATH] == $PATH) // false\n})\n\n// options is optional, takes same options as `npmPath.set`\nnpmPath.get(options, function(err, $PATH) {\n  console.log($PATH)\n})\n```\n\n#### Synchronous Alternative\n\n```js\n//  supplying no callback will execute method synchronously\nvar $PATH = npmPath.get()\nconsole.log($PATH)\nconsole.log(process.env[PATH] == $PATH) // false\n\n// more explicit alternative syntax\n$PATH = npmPath.getSync()\n\n```\n\n### Options\n\nBoth `set` and `get` take an optional options object, with optional `env` & `cwd` keys.\n\n* Set `options.env` if you wish to use something other than `process.env` (the default)\n* Set `options.cwd` if you wish to use something other than `process.cwd()` (the default)\n\nThere's also a `options.npm` property which you can set if you want `node-gyp` to be sourced from\nan alternative `npm` installation.\n\n### Get the PATH environment variable key\n\n```js\n// windows calls it's path \"Path\" usually, but this is not guaranteed.\nnpmPath.PATH // 'Path', probably\n\n// rest of the world\nnpmPath.PATH // 'PATH'\n\n```\n\n#### Example Usage\n\n```js\nprocess.env[npmPath.PATH] // get path environment variable\n\n// set path environment variable manually\nprocess.env[npmPath.PATH] = npmPath.get()\n\n// set path environment variable automatically\nnpmPath()\n```\n\n### Get the PATH separator\n\n```js\n// windows\nnpmPath.SEPARATOR // ';'\n\n// rest of the world\nnpmPath.SEPARATOR // ':'\n```\n\n## Credit\n\nPath lookup code adapted directly from npm.\n\nThanks to [Jordan Harband](https://github.com/ljharb) for his [hard work](https://github.com/timoxley/npm-path/pulls?q=is%3Apr+author%3Aljharb) adapting this to work on node 0.8.\n\n# License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/timoxley/npm-path","bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"license":"MIT"}