pnpm Workspaces/Run command from workspace root only

Run a command in the workspace root context.

Section: Workspace Basics

Run command from workspace root only

bash
bash
pnpm -w exec node -p process.cwd()
Explanation

Run a command in the workspace root context.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Workspace Basics
Add a dependency to workspace root
Install a dependency into the workspace root package.json.
OpenIn sheetbashsame section
Create pnpm-workspace.yaml
Define the workspace root and included package globs.
OpenIn sheetbashsame section
Install workspace dependencies
Inside a workspace, pnpm installs dependencies for all projects by default.
OpenIn sheetbashsame section
List workspace packages
Show workspace packages and their top-level dependencies.
OpenIn sheetbashsame section
Filter exact package
Target a single package by name.
OpenIn sheetbash2 tag match
Deploy one workspace package
Copy a package with isolated production dependencies to a target directory.
OpenIn sheetbash2 tag match