Gathering detailed insights and metrics for get-installed-path
Gathering detailed insights and metrics for get-installed-path
Gathering detailed insights and metrics for get-installed-path
Gathering detailed insights and metrics for get-installed-path
npm-run-path
Get your PATH prepended with locally installed binaries
global-dirs
Get the directory of globally installed packages and binaries
@types/get-installed-path
TypeScript definitions for get-installed-path
@esm2cjs/npm-run-path
Get your PATH prepended with locally installed binaries. This is a fork of sindresorhus/npm-run-path, but with CommonJS support.
Get locally or globally installation path of given package name.
npm install get-installed-path
Typescript
Module System
Min. Node Version
Node Version
NPM Version
96.4
Supply Chain
100
Quality
74.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
25,976,176
Last Day
6,384
Last Week
143,777
Last Month
717,292
Last Year
8,028,732
MIT License
43 Stars
212 Commits
7 Forks
3 Watchers
16 Branches
3 Contributors
Updated on Nov 30, 2024
Minified
Minified + Gzipped
Latest Version
4.0.8
Package Id
get-installed-path@4.0.8
Size
7.72 kB
NPM Version
5.4.2
Node Version
8.7.0
Published on
Oct 12, 2017
Cumulative downloads
Total Downloads
1
Get installation path where the given package is installed. Works for globally and locally installed packages
You might also be interested in detect-installed.
If you have any how-to kind of questions, please read Code of Conduct and join the chat room or open an issue.
You may also read the Contributing Guide. There, beside "How to contribute?", we describe everything stated by the badges.
(TOC generated by verb using markdown-toc)
This project requires Node.js v6 and above. Use yarn v1 / npm v5 or above to install it.
$ yarn add get-installed-path
Review carefully the provided examples and the working tests.
Get installed path of globally or locally
name
package. By default it checks ifname
exists as directory in global-modules directory of the system. Passopts.local
to get path ofname
package from local directory or fromopts.cwd
. Returns rejected promise if module not found in global/localnode_modules
folder or if it exist but is not a directory.
Params
name
{string}: package nameopts
{Object}: pass opts.local
to check locallyreturns
{Promise}: rejected promise if name
not a string or is empty stringExample
1const { getInstalledPath } = require('get-installed-path') 2 3getInstalledPath('npm').then((path) => { 4 console.log(path) 5 // => '/home/charlike/.nvm/path/to/lib/node_modules/npm' 6}) 7 8getInstalledPath('foo-bar-barwerwlekrjw').catch((err) => { 9 console.log(err.message) 10 // => 'module not found "foo-bar-barwerwlekrjw" in path ...' 11}) 12 13getInstalledPath('npm', { 14 local: true 15}).catch((err) => { 16 console.log(err.message) 17 // => 'module not found "foo-bar-barwerwlekrjw" in path ...' 18}) 19 20getInstalledPath('global-modules', { 21 local: true 22}).then((path) => { 23 console.log(path) 24 // => '~/code/get-installed-path/node_modules/global-modules' 25}) 26 27// If you are using it for some sub-directory 28// pass `opts.cwd` to be where the `node_modules` 29// folder is. 30process.chidr('foo-bar-baz') 31getInstalledPath('global-modules', { 32 local: true, 33 cwd: '../' 34}).then((path) => { 35 console.log(path) 36 // => '~/code/get-installed-path/node_modules/global-modules' 37}) 38 39// When searching for the path of a package that is required 40// by several other packages, its path may not be in the 41// closest node_modules. In this case, to search recursively, 42// you can use the following: 43getInstalledPath('npm', { 44 paths: process.mainModule.paths 45}).then((path) => { 46 // ... 47}) 48// `process.mainModule` refers to the location of the current 49// entry script.
Get installed path of a
name
package synchronous. Returnsboolean
whenpaths
option is used and filepath is directory, otherwise returns a full filepath OR throws error.
Params
name
{string}: package nameopts
{Object}: pass opts.local
to check locallyreturns
{string}: The full filepath or throw TypeError
if name
not a string or is empty stringExample
1const { getInstalledPathSync } = require('get-installed-path') 2 3const npmPath = getInstalledPathSync('npm') 4console.log(npmPath) 5// => '/home/charlike/.nvm/path/to/lib/node_modules/npm' 6 7const gmPath = getInstalledPathSync('global-modules', { local: true }) 8console.log(gmPath) 9// => '~/code/get-installed-path/node_modules/global-modules'
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the Contributing Guide and Code of Conduct documents for advices.
Copyright © 2016-2017, Charlike Mike Reagent. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on October 12, 2017.
Project scaffolded and managed with hela.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
67 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-10.6%
6,384
Compared to previous day
Last Week
-25.4%
143,777
Compared to previous week
Last Month
6.7%
717,292
Compared to previous month
Last Year
25.3%
8,028,732
Compared to previous year