How to fix npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing in npm

npmINTERMEDIATEHIGHUpdated Dec 5, 2025ยท 170 views

The EWORKSPACEMISSING error occurs when npm cannot find a workspace referenced in your monorepo configuration. This happens when a workspace is defined in package.json but the directory doesn't exist or the package name doesn't match.

Quick fix

Fixes npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing

{
  "name": "my-monorepo",
  "workspaces": [
    "packages/*",
    "apps/web",
    "tools/cli"
  ]
}
  1. Verify the workspaces array in root package.json
  2. Confirm all workspace directories exist
  3. Check workspace package names match references
  4. Reinstall from the root directory
npm โ€” error
{
"name": "my-monorepo",
"workspaces": [
"packages/*",
"apps/web",
"tools/cli"
]
}
npm ERR! code EWORKSPACEMISSING
npm ERR! Workspace does not exist: packages/missing

What this error means

npm workspaces allow you to manage multiple packages in a single repository (monorepo). The EWORKSPACEMISSING error means that your root package.json declares a workspace that npm cannot locate. This typically occurs when the directory specified in the workspaces array doesn't exist on disk, the package name you're trying to reference doesn't match the actual package.json name inside the workspace, you're using a glob pattern that doesn't match any directories, or a workspace directory was deleted but the configuration wasn't updated. This prevents npm from properly linking workspace dependencies, which breaks commands like npm install, npm run, and other workspace-aware operations.

Typical symptoms

  • npm install, npm run, or npm commands fail with 'Workspace does not exist' message
  • Workspace dependencies are not symlinked in node_modules
  • Running npm commands in a workspace subdirectory doesn't work correctly
  • CI/CD pipelines fail when attempting to run workspace-specific scripts
  • Getting warnings about specific package names in filter sets that don't have workspace folders

Common causes

  1. Workspace directory was deleted or renamed but package.json configuration wasn't updated
  2. Typo in the workspaces array path - e.g., packages/my-package instead of packages/my-pkg
  3. Package name in workspace package.json doesn't match the name referenced with -w flag
  4. Glob pattern in workspaces array doesn't match any directories
  5. Running npm commands from a workspace subdirectory when the root package.json workspaces configuration is missing

How to fix "npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing"

1Verify the workspaces array in root package.json

Open your root package.json and check the workspaces field. Make sure the paths or glob patterns are correctly defined:

json
{
  "name": "my-monorepo",
  "workspaces": [
    "packages/*",
    "apps/web",
    "tools/cli"
  ]
}

Common valid patterns:
- "packages/*" - all folders inside packages/
- "packages/core" - specific folder
- ["packages/*", "apps/*"] - multiple patterns

2Confirm all workspace directories exist

Run this command to verify the directories actually exist on disk:

bash
ls -la packages/
ls -la apps/

If directories listed in package.json don't appear in the output, you need to either:
- Create the missing directories with mkdir -p packages/missing-workspace
- Update package.json to remove references to deleted directories
- Restore the missing directories from version control

3Check workspace package names match references

When using the -w flag, you must use the actual package name from each workspace's package.json, not the folder name. For example:

bash
# Inside packages/my-app/package.json, if "name" is "@myorg/my-app"
# Use this command:
npm install -w @myorg/my-app

# NOT this (wrong - uses folder name):
npm install -w my-app

To find the correct package names, check each workspace's package.json:

bash
cat packages/*/package.json | grep '"name"'
4Reinstall from the root directory

Once you've corrected the configuration, clean up and reinstall:

bash
rm -rf node_modules package-lock.json
rm -rf packages/*/node_modules

# Reinstall from root
cd /path/to/root
npm install

This rebuilds symlinks between workspace packages and ensures npm recognizes all workspaces correctly.

Advanced notes

If you're using Turborepo or other monorepo tools, they have additional validation on top of npm workspaces. Turborepo explicitly requires npm workspaces to be defined in the root package.json. For pnpm or Yarn users, the configuration differs - pnpm uses pnpm-workspace.yaml and Yarn has its own workspace syntax. Package scopes (e.g., @myorg/package) are common in monorepos to avoid name conflicts. The package.json name field is what npm uses internally, not the folder name.

Frequently asked questions

What does "npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: pac" mean?
npm workspaces allow you to manage multiple packages in a single repository (monorepo). json declares a workspace that npm cannot locate. json name inside the workspace, you're using a glob pattern that doesn't match any directories, or a workspace directory was deleted but the configuration wasn't updated.
How do I fix "npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: pac"?
The EWORKSPACEMISSING error occurs when npm cannot find a workspace referenced in your monorepo configuration. This happens when a workspace is defined in package.json but the directory doesn't exist or the package name doesn't match.
What causes "npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: pac"?
Workspace directory was deleted or renamed but package.json configuration wasn't updated Typo in the workspaces array path - e.g., packages/my-package instead of packages/my-pkg Package name in workspace package.json doesn't match the name referenced with -w flag
Is the "npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: pac" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading