{"id":15365502,"url":"https://github.com/tunnckocore/get-installed-path","last_synced_at":"2025-07-28T17:08:27.197Z","repository":{"id":30591969,"uuid":"34147097","full_name":"tunnckoCore/get-installed-path","owner":"tunnckoCore","description":"Get locally or globally installation path of given package name.","archived":false,"fork":false,"pushed_at":"2022-12-09T08:02:16.000Z","size":1053,"stargazers_count":43,"open_issues_count":18,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-21T23:44:48.874Z","etag":null,"topics":["detect","install","is-installed","modules","npm","package","path"],"latest_commit_sha":null,"homepage":"https://tunnckocore.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tunnckoCore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"tunnckoCore","custom":["https://gumroad.com/l/tunnckoCoreRecurringDonation"]}},"created_at":"2015-04-18T00:57:44.000Z","updated_at":"2024-11-30T05:18:06.000Z","dependencies_parsed_at":"2023-01-14T17:16:59.204Z","dependency_job_id":null,"html_url":"https://github.com/tunnckoCore/get-installed-path","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/tunnckoCore/get-installed-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fget-installed-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fget-installed-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fget-installed-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fget-installed-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tunnckoCore","download_url":"https://codeload.github.com/tunnckoCore/get-installed-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fget-installed-path/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267552097,"owners_count":24106000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detect","install","is-installed","modules","npm","package","path"],"created_at":"2024-10-01T13:14:55.054Z","updated_at":"2025-07-28T17:08:27.148Z","avatar_url":"https://github.com/tunnckoCore.png","language":"JavaScript","funding_links":["https://ko-fi.com/tunnckoCore","https://gumroad.com/l/tunnckoCoreRecurringDonation","https://paypal.me/tunnckoCore/10"],"categories":[],"sub_categories":[],"readme":"# get-installed-path [![npm version][npmv-img]][npmv-url] [![github release][github-release-img]][github-release-url] [![mit License][license-img]][license-url] [![NPM Downloads Total][downloads-total-img]][npmv-url] \n\n\u003c!--\n[![NPM Downloads Weekly][downloads-weekly-img]][npmv-url]\n[![NPM Downloads Total][downloads-total-img]][npmv-url] --\u003e\n\n\u003e Get installation path where the given package is installed. Works for globally and locally installed packages\n\n\u003cdiv id=\"thetop\"\u003e\u003c/div\u003e\n\nYou might also be interested in [detect-installed](https://github.com/tunnckocore/detect-installed#readme).\n\n## Quality Assurance :100:\n\n[![Code Climate][codeclimate-img]][codeclimate-url] \n[![Code Style Standard][standard-img]][standard-url] \n[![Linux Build][travis-img]][travis-url] \n[![Code Coverage][codecov-img]][codecov-url] \n[![Dependencies Status][dependencies-img]][dependencies-url] \n[![Renovate App Status][renovate-img]][renovate-url] \n[![Node Version Required][nodeversion-img]][nodeversion-url] \n\nIf you have any _how-to_ kind of questions, please read [Code of Conduct](./CODE_OF_CONDUCT.md) and **join the chat** room or [open an issue][open-issue-url].  \nYou may also read the [Contributing Guide](./CONTRIBUTING.md). There, beside _\"How to contribute?\"_, we describe everything **_stated_** by  the badges.\n\n[![tunnckoCore support][chat-img]][chat-url] \n[![Code Format Prettier][prettier-img]][prettier-url] \n[![Node Security Status][nodesecurity-img]][nodesecurity-url] \n[![Conventional Commits][ccommits-img]][ccommits-url] \n[![Semantic Release][semantic-release-img]][semantic-release-url] \n[![First Timers Only][first-timers-only-img]][first-timers-only-url] \n\n\n[![All Contributors Spec][all-contributors-img]](#contributors) \n[![Make A Pull Request][prs-welcome-img]][prs-welcome-url] \n[![Newsletter Subscribe][tinyletter-img]][tinyletter-url] \n[![PayPal Author Support][paypal-donate-img]][paypal-donate-url] \n[![Share Love][share-love-img]][share-love-url] \n[![BitHound Code][bithound-code-img]][bithound-code-url] \n\n## Table of Contents\n- [Install](#install)\n- [API](#api)\n  * [getInstalledPath](#getinstalledpath)\n  * [getInstalledPathSync](#getinstalledpathsync)\n- [Related](#related)\n- [Contributing](#contributing)\n- [Author](#author)\n- [License](#license)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nThis project requires [**Node.js**][nodeversion-url] **v6** and above. Use [**yarn**](https://yarnpkg.com) **v1** / [**npm**](https://www.npmjs.com) **v5** or above to install it.\n\n```\n$ yarn add get-installed-path\n```\n\n## API\nReview carefully the provided examples and the working [tests](./test/index.js).\n\n### [getInstalledPath](src/index.js#L71)\n\n\u003e Get installed path of globally or locally `name` package.\nBy default it checks if `name` exists as directory in [global-modules][]\ndirectory of the system. Pass `opts.local` to get path of `name`\npackage from local directory or from `opts.cwd`. Returns rejected\npromise if module not found in global/local `node_modules` folder or\nif it exist but is not a directory.\n\n**Params**\n\n* `name` **{string}**: package name    \n* `opts` **{Object}**: pass `opts.local` to check locally    \n* `returns` **{Promise}**: rejected promise if `name` not a string or is empty string  \n\n**Example**\n\n```jsx\nconst { getInstalledPath } = require('get-installed-path')\n\ngetInstalledPath('npm').then((path) =\u003e {\n  console.log(path)\n  // =\u003e '/home/charlike/.nvm/path/to/lib/node_modules/npm'\n})\n\ngetInstalledPath('foo-bar-barwerwlekrjw').catch((err) =\u003e {\n  console.log(err.message)\n  // =\u003e 'module not found \"foo-bar-barwerwlekrjw\" in path ...'\n})\n\ngetInstalledPath('npm', {\n  local: true\n}).catch((err) =\u003e {\n  console.log(err.message)\n  // =\u003e 'module not found \"foo-bar-barwerwlekrjw\" in path ...'\n})\n\ngetInstalledPath('global-modules', {\n  local: true\n}).then((path) =\u003e {\n  console.log(path)\n  // =\u003e '~/code/get-installed-path/node_modules/global-modules'\n})\n\n// If you are using it for some sub-directory\n// pass `opts.cwd` to be where the `node_modules`\n// folder is.\nprocess.chidr('foo-bar-baz')\ngetInstalledPath('global-modules', {\n  local: true,\n  cwd: '../'\n}).then((path) =\u003e {\n  console.log(path)\n  // =\u003e '~/code/get-installed-path/node_modules/global-modules'\n})\n\n// When searching for the path of a package that is required\n// by several other packages, its path may not be in the\n// closest node_modules. In this case, to search recursively,\n// you can use the following:\ngetInstalledPath('npm', {\n paths: process.mainModule.paths\n}).then((path) =\u003e {\n // ...\n})\n// `process.mainModule` refers to the location of the current\n// entry script.\n```\n\n### [getInstalledPathSync](src/index.js#L124)\n\n\u003e Get installed path of a `name` package synchronous.\nReturns `boolean` when `paths` option is used and filepath is directory,\notherwise returns a full filepath OR throws error.\n\n**Params**\n\n* `name` **{string}**: package name    \n* `opts` **{Object}**: pass `opts.local` to check locally    \n* `returns` **{string}**: The full filepath or throw `TypeError` if `name` not a string or is empty string  \n\n**Example**\n\n```jsx\nconst { getInstalledPathSync } = require('get-installed-path')\n\nconst npmPath = getInstalledPathSync('npm')\nconsole.log(npmPath)\n// =\u003e '/home/charlike/.nvm/path/to/lib/node_modules/npm'\n\nconst gmPath = getInstalledPathSync('global-modules', { local: true })\nconsole.log(gmPath)\n// =\u003e '~/code/get-installed-path/node_modules/global-modules'\n```\n\n**[back to top](#thetop)**\n\n## Related\n- [always-done](https://www.npmjs.com/package/always-done): Handle completion and errors with elegance! Support for streams, callbacks, promises, child… [more](https://github.com/hybridables/always-done#readme) | [homepage](https://github.com/hybridables/always-done#readme \"Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement for [async-done][] - pass 100% of its tests plus more\")\n- [detect-installed](https://www.npmjs.com/package/detect-installed): Checks that given package is installed globally or locally. | [homepage](https://github.com/tunnckocore/detect-installed#readme \"Checks that given package is installed globally or locally.\")\n- [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules \"The directory used by npm for globally installed npm modules.\")\n- [global-paths](https://www.npmjs.com/package/global-paths): Returns an array of unique \"global\" directories based on the user's platform… [more](https://github.com/jonschlinkert/global-paths) | [homepage](https://github.com/jonschlinkert/global-paths \"Returns an array of unique \"global\" directories based on the user's platform and environment. The resulting paths can be used for doing lookups for generators or other globally installed npm packages. Node.js / JavaScript.\")\n- [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix \"Get the npm global path prefix.\")\n- [is-installed](https://www.npmjs.com/package/is-installed): Checks that given package is installed locally or globally. Useful for robust… [more](https://github.com/tunnckocore/is-installed#readme) | [homepage](https://github.com/tunnckocore/is-installed#readme \"Checks that given package is installed locally or globally. Useful for robust resolving when you want some package - it will check first if it exists locally, then if it exists globally\")\n- [minibase](https://www.npmjs.com/package/minibase): Minimalist alternative for Base. Build complex APIs with small units called plugins… [more](https://github.com/node-minibase/minibase#readme) | [homepage](https://github.com/node-minibase/minibase#readme \"Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing [base][] plugins.\")\n- [try-catch-core](https://www.npmjs.com/package/try-catch-core): Low-level package to handle completion and errors of sync or asynchronous functions… [more](https://github.com/hybridables/try-catch-core#readme) | [homepage](https://github.com/hybridables/try-catch-core#readme \"Low-level package to handle completion and errors of sync or asynchronous functions, using [once][] and [dezalgo][] libs. Useful for and used in higher-level libs such as [always-done][] to handle completion of anything.\")\n\n**[back to top](#thetop)**\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue][open-issue-url].  \nPlease read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents for advices.  \n\n## Author\n- [github/tunnckoCore](https://github.com/tunnckoCore)\n- [twitter/tunnckoCore](https://twitter.com/tunnckoCore)\n- [codementor/tunnckoCore](https://codementor.io/tunnckoCore)\n\n## License\nCopyright © 2016-2017, [Charlike Mike Reagent](https://i.am.charlike.online). Released under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 12, 2017._  \nProject scaffolded and managed with [hela][].\n\n[always-done]: https://github.com/hybridables/always-done\n[async-done]: https://github.com/gulpjs/async-done\n[base]: https://github.com/node-base/base\n[charlike-cli]: https://github.com/tunnckoCore/charlike-cli\n[dezalgo]: https://github.com/npm/dezalgo\n[global-modules]: https://github.com/jonschlinkert/global-modules\n[hela]: https://github.com/tunnckoCore/hela\n[once]: https://github.com/isaacs/once\n\n\u003c!-- Heading badges --\u003e\n[npmv-url]: https://www.npmjs.com/package/get-installed-path\n[npmv-img]: https://img.shields.io/npm/v/get-installed-path.svg?label=npm%20version\n\n[open-issue-url]: https://github.com/tunnckoCoreLabs/get-installed-path/issues/new\n[github-release-url]: https://github.com/tunnckoCoreLabs/get-installed-path/releases/latest\n[github-release-img]: https://img.shields.io/github/release/tunnckoCoreLabs/get-installed-path.svg?label=github%20release\n\n[license-url]: https://github.com/tunnckoCoreLabs/get-installed-path/blob/master/LICENSE\n[license-img]: https://img.shields.io/npm/l/get-installed-path.svg\n\n[downloads-weekly-img]: https://img.shields.io/npm/dw/get-installed-path.svg\n[downloads-monthly-img]: https://img.shields.io/npm/dm/get-installed-path.svg\n[downloads-total-img]: https://img.shields.io/npm/dt/get-installed-path.svg\n\n\u003c!-- Front line badges --\u003e\n[codeclimate-url]: https://codeclimate.com/github/tunnckoCoreLabs/get-installed-path\n[codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCoreLabs/get-installed-path.svg\n\n[standard-url]: https://github.com/standard/standard\n[standard-img]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n\n[travis-url]: https://travis-ci.org/tunnckoCoreLabs/get-installed-path\n[travis-img]: https://img.shields.io/travis/tunnckoCoreLabs/get-installed-path/master.svg?label=linux\n\n[codecov-url]: https://codecov.io/gh/tunnckoCoreLabs/get-installed-path\n[codecov-img]: https://img.shields.io/codecov/c/github/tunnckoCoreLabs/get-installed-path/master.svg\n\n[dependencies-url]: https://david-dm.org/tunnckoCoreLabs/get-installed-path\n[dependencies-img]: https://img.shields.io/david/tunnckoCoreLabs/get-installed-path.svg\n\n[renovate-url]: https://renovateapp.com\n[renovate-img]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg\n\n\u003c!-- Second front of badges --\u003e\n\n[chat-url]: https://tunnckocore.flock.com/?i=cx2xoeofjtj6eo6c\n[chat-img]: https://img.shields.io/badge/chat-on_flock-brightgreen.svg\n\n[prettier-url]: https://github.com/prettier/prettier\n[prettier-img]: https://img.shields.io/badge/styled_with-prettier-f952a5.svg\n\n[nodesecurity-url]: https://nodesecurity.io/orgs/tunnckocore/projects/976d071f-5f2e-4ca6-9583-8c2b9dbf6e76/master\n[nodesecurity-img]: https://nodesecurity.io/orgs/tunnckocore/projects/976d071f-5f2e-4ca6-9583-8c2b9dbf6e76/badge\n\u003c!-- the original color of nsp: \n[nodesec-img]: https://img.shields.io/badge/nsp-no_known_vulns-35a9e0.svg --\u003e\n\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n\n[ccommits-url]: https://conventionalcommits.org/\n[ccommits-img]: https://img.shields.io/badge/conventional_commits-1.0.0-yellow.svg\n\n[nodeversion-url]: https://nodejs.org/en/download\n[nodeversion-img]: https://img.shields.io/node/v/get-installed-path.svg\n\n[first-timers-only-img]: https://img.shields.io/badge/first--timers--only-friendly-blue.svg\n[first-timers-only-url]: http://www.firsttimersonly.com\n\n[prs-welcome-img]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg\n[prs-welcome-url]: http://makeapullrequest.com\n\n[all-contributors-img]: https://img.shields.io/github/contributors/tunnckoCore/get-installed-path.svg?label=all%20contributors\u0026colorB=ffa500\n\n[bithound-deps-url]: https://www.bithound.io/github/tunnckoCore/get-installed-path/master/dependencies/npm\n[bithound-deps-img]: https://www.bithound.io/github/tunnckoCore/get-installed-path/badges/dependencies.svg\n\n[bithound-code-url]: https://www.bithound.io/github/tunnckoCore/get-installed-path/master\n[bithound-code-img]: https://www.bithound.io/github/tunnckoCore/get-installed-path/badges/code.svg\n\n[paypal-donate-url]: https://paypal.me/tunnckoCore/10\n[paypal-donate-img]: https://img.shields.io/badge/paypal-donate-009cde.svg\n\n[tinyletter-url]: https://tinyletter.com/tunnckoCore\n[tinyletter-img]: https://img.shields.io/badge/newsletter-subscribe-9caaf8.svg\n\n[share-love-url]: https://twitter.com/intent/tweet?text=https://github.com/tunnckoCore/get-installed-path\u0026via=tunnckoCore\n[share-love-img]: https://img.shields.io/badge/share-♥-ed1c24.svg\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Fget-installed-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftunnckocore%2Fget-installed-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Fget-installed-path/lists"}