[BUG] Different behavior for npm pkg for root package and workspaces
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
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
I have a project with packages defined as workspaces
If i run the following command in the root folder - it works as expected
/gitlab-ci-cli (main) $ npm pkg get name
"gitlaber"
if i run same command for workspace - it always responds with json:
gitpod /workspace/gitlab-ci-cli/packages/commands (main) $ npm pkg get name
{
"@gitlaber/commands": "@gitlaber/commands"
}
Using --json=false doesn't help. So it looks like somewhere --json is used internally
Expected Behavior
This command should work identically for all packages respecting --json parameter
Steps To Reproduce
- Init project
- Add workspace project
- run
npm pkg get namein the root folder - run
npm pkg get namein the workspace folder
Output format is different
Environment
- npm: 8.19.1
- Node.js: 16.17.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two npm pkg get name commands in a project with a root package and workspace, including --json=false, using the reported npm and Node.js versions if available. Compare the root and workspace output paths; done means both packages respect the requested JSON format consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100