Listing globally installed packages
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Description
I have some `~/bin` scripts with `node` shebang and was wondering how to list those `--global` packages I use.
`npm list --global` vs `thanks --global`
I have `node` installed via `nvm`, so I tried manually going to `node_modules` directory. Unfortunately, it does not seem like `npm` maintains `package.json` for `--global`ly installed packages and `thanks` hangs forever in case that file is missing:
``` sh
$ cd .nvm/versions/node/v8.9.4/lib/node_modules
$ thanks
💙 Reading direct dependencies from metadata in package.json...(node:31267) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: path must be a string or Buffer
(node:31267) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
💛 Reading direct dependencies from metadata in package.json...^C⏎
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported commands, especially `thanks` from the global Node modules directory under nvm, and inspect how global package metadata is located. Done means globally installed packages can be listed and a missing package.json is handled without hanging or producing an unhandled rejection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100