ls-list Verified current stable Not installed? Package Management

Ls List / Print Tree Of Locally Installed Modules

Print Tree Of Locally Installed Modules

Displays a tree structure of locally installed packages in the project.

$
Terminal
pnpm ls

When To Use

When verifying installed packages after dependency updates or installs.

Pro Tip

Use `--long` for detailed output including version numbers and dependency paths.

Anatomy of Output

Understanding the result

example-package@1.0.0 Top Level Package

Indicates a direct dependency installed.

└── dependency1@2.0.0 Dependency

Shows a nested dependency of the top level package.

└── dependency2@3.0.0 Dependency

Another nested dependency.

Troubleshooting

Common pitfalls

ERR_PNPM_NO_PACKAGE_FOUND: No packages found in project

Solution: Check if you are in the correct directory that contains the package.json.

ERR_PNPM_TREE_BUILD_FAILED: Failed to build the package tree

Solution: Ensure all dependencies are installed properly before listing.

ERR_PNPM_INVALID_OUTPUT: Unexpected error printing package tree

Solution: Check for permission issues preventing visibility of node_modules.

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.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.