Ls List / List Top Level Globally Installed Modules
List Top Level Globally Installed Modules
Lists all globally installed modules without their dependencies.
pnpm ls -g --depth <0> pnpm ls -g --depth <0> #!/bin/bash
# List Top Level Globally Installed Modules
pnpm {{[ls|list]}} {{[-g|--global]}} --depth {{0}} import subprocess
# List Top Level Globally Installed Modules
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"ls-list",
"ls",
"-g",
"--depth",
"<0>"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: ls-list not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
When diagnosing global package installations before executing a new global install.
Pro Tip
Use `--dev-only` to filter and show only development dependencies in global scope.
Anatomy of Output
Understanding the result
global-package-1@1.0.0 Global Package Indicates globally installed packages.
example-cli-tool@1.2.3 Global CLI Tool Another tool available for system-wide use.
# Use `npm uninstall -g <package>` to remove a globally installed package Note Instruction for package removal.
Troubleshooting
Common pitfalls
ERR_PNPM_GLOBAL_LIST_FAILED: Failed to list global packages
Solution: Check if you have proper access to the global store.
ERR_PNPM_NO_GLOBAL_PACKAGES: No global packages found
Solution: Install a package globally before running this command.
ERR_PNPM_TREE_BUILD_FAILED: Unable to build the package tree
Solution: Ensure pnpm is properly configured and installed.
Command Breakdown
What each part is doing
-
pnpm - Base Command
- The executable that performs this operation. Here it runs Ls List before the shell applies any redirect operators.
-
ls - ls|list
- The value supplied for ls|list.
-
-g - g| global
- The value supplied for g| global.
-
<0> - 0
- The value supplied for 0.
-
-g - Command Option
- Tool-specific option used by this command invocation.
-
--depth - Command Option
- Tool-specific option used by this command invocation.
Alternative Approaches
Comparable commands in other tools
Alternative package management tools for the same job.