npm / cli

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

[BUG] `npm owner` does not support workspaces #4600

Closed nlf closed 2 years ago

nlf commented 2 years ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

running npm owner commands from within a workspace in a project logs the following error

npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

Expected Behavior

commands should work as expected. we'll need to modify the getPkg method such that it is workspace aware, as well as add the execWorkspaces method which appears it can call exec directly.

Steps To Reproduce

  1. Clone this repo
  2. cd workspaces/arborist
  3. npm owner ls
  4. See error...

Environment

darcyclarke commented 2 years ago

Interesting, looks like npm doctor also is throwing in this setting. I know there was an initial set of commands we decided wouldn't support workspaces out the gate (ref. https://github.com/npm/rfcs/blob/main/accepted/0038-workspaces-run-cmds.md#3-unsupported) but given that we now support auto detection, I think we need to just triple check each command works when navigating into a workspace dir.

fritzy commented 2 years ago

@darcyclarke you may want to move this to a priority 1, since this is due to recent changes.

alexjoverm commented 2 years ago

Agree with @fritzy here. We use semantic-release at Storyblok to automatically release all our SDK packages. Semantic release runs npm owner under the hood, and due to this issue, the releases of our whole SDK ecosystem were broken.

In case this is happening to you, for us downgrading to 16.13.2 on our Github Actions config worked well 👌 https://github.com/storyblok/storyblok-js/runs/5855290031

bnb commented 2 years ago

Interesting, looks like npm doctor also is throwing in this setting. I know there was an initial set of commands we decided wouldn't support workspaces out the gate (ref. https://github.com/npm/rfcs/blob/main/accepted/0038-workspaces-run-cmds.md#3-unsupported) but given that we now support auto detection, I think we need to just triple check each command works when navigating into a workspace dir.

I just ran into npm doctor not supporting workspaces. Hilariously, I tried running it to see if it'd be able to help me figure out why one of my workspaces isn't working despite all my configuration being apparently correct.

wraithgar commented 2 years ago

This is fixed in v8.9.0

mattclough1 commented 1 year ago

Is it expected that npm set gives the same error?

Edit: I see this is covered in #6099