cli
cli copied to clipboard
[BUG] npm exec -w [workspace] doesn't local deps installed in parent-repository node_modules
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] 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 do not have this issue with
- I can confirm this issue does not occur with npm 9.8.1
@wimbarelds try with npm exec -w child-workspace --package=@pega/dx-component-builder-sdk
@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