node.jsnpm

npm workspaces "WARN: some-package-name in filter set, but no workspace folder present"


I have a repo with many npm packages inside, using npm workspaces

The top-level package.json contains the line:

  "workspaces": [
    "*"
  ]

When I run npm i -ws or other npm commands, I receive the warning:

WARN: some-package-name in filter set, but no workspace folder present

I'm not quite sure what the message means - I think the 'filter set' is the -w option, but the workspace folder some-package-name definitely exists.

One note is that the some-package-name/package.json contains an org prefix, eg:

"name": "@mycompany/some-package-name",

So maybe that's the cause. I can't rename the folder from some-package-name to @mycompany/some-package-name though as I'm concerned a directory starting with @ may break things.

What does the warning mean and how can I resolve it?


Solution

  • I ran into the same problem, using the name configured in the workspace's package instead of the folder name fixed the issue for me, even with an @.

    npm install --workspace=@mycompany/some-package-name

    The issue may appear for the package in question package.json and package-lock.json name fields do not match the workspace folder naming and package name and / or each other.

    The command updated both name fields so that the warning is gone.