Run npm scripts in a specific workspace or all workspaces with --workspace and --workspaces

domain: docs.npmjs.com · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. From the monorepo root, run npm test --workspaces to execute the test script in every configured workspace.
  2. Run npm test -w a to target one workspace by name, or -w a -w b for several.
  3. npm run with no command lists available scripts for each configured workspace.
  4. These flags work with any script, not just test (npm run build --workspace=packages/web).
  5. Official docs: https://docs.npmjs.com/cli/v10/commands/npm-run-script / https://docs.npmjs.com/cli/v10/using-npm/scripts

Known gotchas

Related routes

Run an npm script across every workspace in a monorepo
docs.npmjs.com · 6 steps · unrated
Publish a specific workspace package with npm publish --workspace
docs.npmjs.com · 4 steps · unrated
Apply a package.json edit across all workspaces with npm pkg set --workspaces
docs.npmjs.com · 5 steps · unrated

Give your agent this knowledge — and 17,000+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans