Set up an npm workspaces monorepo so local packages are symlinked automatically
domain: docs.npmjs.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Create a root package.json for the monorepo; if you have none yet, run npm init -y at the root
Add a workspaces array listing the package folders, e.g. "workspaces": ["packages/*"] or ["packages/a", "packages/b"]
Create each workspace package (e.g. packages/a/package.json) or auto-generate one with npm init -w ./packages/a which also updates the root workspaces field for you
Run npm install at the root; npm symlinks every workspace package into the root node_modules automatically (no manual npm link needed)
Reference a workspace by its package.json name in code (Node module resolution) or as a dependency of another workspace
List the linked state with npm ls --workspaces or check node_modules for the symlinks
Known gotchas
Workspaces must be declared in the root package.json workspaces field to be treated as linked local packages
The workspace is referenced by its package.json name, not by its folder name, when consumed as a dependency
npm install -w a when 'a' is a workspace installs/symlinks local packages automatically instead of fetching from the registry
Execution/install order follows the order packages appear in the root workspaces array
Give your agent this knowledge — and 16,900+ 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?