Skip to content

[BUG] npm exec -w [workspace] doesn't local deps installed in parent-repository node_modules #7379

@wimbarelds

Description

@wimbarelds

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 a workspace has a (bin) @scope/dependency thats installed in the root-workspace's node_modules; and you execute it with npm exec -w child-workspace @scope/name, the node_modules from root-workspace is ignored and global version is used instead.

Added problem: Since the global node_modules is used, a different version of the package may be used.

Expected Behavior

npm exec -w child-workspace @scope/name uses root_workspace/node_modules/@scope/name

Steps To Reproduce

npm init -y
npm init -w child-workspace -y
npm i -w child-workspace @pega/[email protected]
npm exec -w child-workspace @pega/dx-component-builder-sdk

Result:

Need to install the following packages:
@pega/[email protected]
Ok to proceed? (y)

Environment

  • npm: 10.5.0
  • Node.js: 20.12.2
  • OS Name: MacOS Sonoma 14.3.1
  • System Model Name: Apple M1 Pro
  • npm config:
% npm config ls
; node bin location = /Users/wimbarelds/.nvm/versions/node/v20.12.2/bin/node
; node version = v20.12.2
; npm local prefix = /Users/wimbarelds/projects/npm-test
; npm version = 10.5.0
; cwd = /Users/wimbarelds/projects/npm-test
; HOME = /Users/wimbarelds
; Run `npm config ls -l` to show all defaults.

Notes:

  • I am not completely sure if the scope is relevant
    • I do not have this issue with eslint
    • I do have this issue with @pega/dx-component-builder-sdk.
  • I can confirm this issue does not occur with npm 9.8.1

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions