Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
wimbarelds opened this issue Apr 16, 2024 · 2 comments
Open
2 tasks done
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 10.x

Comments

@wimbarelds
Copy link

wimbarelds commented Apr 16, 2024

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/dx-component-builder-sdk@23.1.11
npm exec -w child-workspace @pega/dx-component-builder-sdk

Result:

Need to install the following packages:
@pega/dx-component-builder-sdk@23.1.14
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
@wimbarelds wimbarelds added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Apr 16, 2024
@milaninfy
Copy link

@wimbarelds try with npm exec -w child-workspace --package=@pega/dx-component-builder-sdk

@wraithgar wraithgar removed the Needs Triage needs review for next steps label Apr 26, 2024
@wraithgar wraithgar self-assigned this Apr 26, 2024
@wraithgar wraithgar added Priority 2 secondary priority issue Priority 1 high priority issue and removed Priority 2 secondary priority issue labels Apr 26, 2024
@wimbarelds
Copy link
Author

@wimbarelds try with npm exec -w child-workspace --package=@pega/dx-component-builder-sdk

Same result as npm exec -w child-workspace @pega/dx-component-builder-sdk, it wants to install global and not use the version already in node_modules

@nishantms nishantms assigned nishantms and unassigned wraithgar and nishantms May 6, 2024
@reggi reggi assigned reggi and unassigned reggi May 6, 2024
@wraithgar wraithgar self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 10.x
Projects
None yet
Development

No branches or pull requests

5 participants