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
JavaScript (100%)
Total Downloads
25,533,653
Last Day
32,994
Last Week
154,595
Last Month
670,773
Last Year
7,987,998
MIT License
43 Stars
212 Commits
7 Forks
3 Watchers
16 Branches
3 Contributors
Updated on Nov 30, 2024
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
Last Day
30.4%
32,994
Compared to previous day
Last Week
7.2%
154,595
Compared to previous week
Last Month
-15.5%
670,773
Compared to previous month
Last Year
27.7%
7,987,998
Compared to previous year
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
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- 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
66 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-04-28
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 More