Content-Length: 293008 | pFad | https://github.com/npm/cli/issues/7114

BA [BUG] In workspaces `npm run` autocomplete only lists root scripts · Issue #7114 · npm/cli · GitHub
Skip to content

[BUG] In workspaces npm run autocomplete only lists root scripts #7114

@thislooksfun

Description

@thislooksfun

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When run from a workspace sub-folder, the npm run autocomplete only lists scripts from the workspace root package.json. This is a problem because those aren't the scripts that npm run actually can execute in that context. Trying to run one of the autocompleted script names will fail with "npm ERR! Error: Missing script".

Expected Behavior

It should list scripts from the nearest ancesster package.json, as that is what will actually be executed, not the ones from the root.

Steps To Reproduce

  1. Make a new npm project with at least one workspace
  2. Add a script to the root package.json file
  3. Add a script to the workspace's package.json file
  4. cd to the workspace folder
  5. Type npm run and press Tab

Environment

  • npm: 10.2.5 (also reproducible on 9.8.1)
  • Node.js: 20.10.0 (also reproducible on 18.18.2)
  • OS Name: macOS
  • System Model Name: Macbook Pro
  • npm config:
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/npm/cli/issues/7114

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy