How can we determine where an npm package was installed from?
I know we can use npm view <package>
to view information about a package from a registry, but what about packages that were not installed from a registry (e.g. a git repo or local directory)?
Specifically, I'm trying to programatically determine whether a globally-installed npm package (CLI tool) was installed from a git repo or from a local directory. This package isn't published in any registries.
Update: For example, one could install a global package from GitHub by either of the following methods:
npm install -g git+https://github.com/linclark/github-pages-deploy.git
git clone https://github.com/linclark/github-pages-deploy && npm install -g github-pages-deploy
How can you tell which method was used to install it?