npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.46k stars 3.15k forks source link

[BUG] Update command gets `workspaces <package name> in filter set, but no workspace folder present` #5863

Open webstech opened 1 year ago

webstech commented 1 year ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

The command npm update -w foo/bar gets unexpected output npm WARN workspaces @foo/bar in filter set, but no workspace folder present

This was shown in the output of issue #3960 here.

The warning is confusing. It suggests the workspace is not present or the npm configuration is incorrect.

The result is the same on both Windows and Linux (docker container).

Expected Behavior

It was expected the -w parameters would be processed without warnings.

The update command does complete but that is not initially obvious to the user.

Suppressing the warning would be great. Converting this issue to a documentation change would still be acceptable, making the message and cause visible. The outdated command does not have this issue.

Steps To Reproduce

  1. In this environment... anywhere?
  2. With this config... default?
  3. Run '...' npm init npm init -w foo/bar (set package name @foo/bar) npm install npm update -w foo/bar
  4. See error... npm WARN workspaces @foo/bar in filter set, but no workspace folder present

Environment

wraithgar commented 1 year ago

Command succeeds just fine, just an erroneous log message

webstech commented 1 year ago

Command succeeds just fine, just an erroneous log message

Agreed, but unfortunately the user new to workspaces does not know the command succeeded. When there are no updates, the rest of the log looks the same as when -w is not specified.

Also, the warning is issued for each workspace when running the command npm update --workspaces.

webstech commented 1 year ago

Not sure if issue #5470 is related. Maybe the missing name attribute in the virtual/real tree is causing the problem?

joepetrillo commented 1 year ago

I agree, if the command works fine why is there a warning? I am not sure I even understand what the error is trying to say. Still seeing this with version 9.6.1.

boonya commented 1 year ago

Same on my end

➜ npm update --save -w @bln/eslint
npm WARN workspaces @bln/eslint in filter set, but no workspace folder present

changed 52 packages, and audited 1691 packages in 60s

273 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

as result

➜ git status
-------------------------------
 M eslint/package.json
 M package-lock.json
 M package.json
 M packages/.../package.json
 M packages/.../package.json
 M packages/.../package.json
 M storybook/package.json
 M test/package.json

I don't think it does work fine.

sebthom commented 7 months ago

The issue is still present in NPM 10.x. This is a very irritating warning message, I am happy I at least found this issue.

relativityboy commented 1 month ago

And 6 months later, 2 hours trying to debug as I learn workspaces. With an incorrect warning message at every update/install/etc, def does not rate as a business grade feature.

Might seem minor to devs on the npm team but - This issue, and issues like this damage npm's reputation, and may reduce fund-ability by 3rd party orgs.