-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 workspaces issue when using different versions of the same package #4990
Comments
Workaround: Use jest programmatically: |
I was able to reproduce this on Windows, but not on other platforms. |
The But when executing |
Running When I run > test
> npm test --workspaces
> test
> echo "testing jest-26" && jest --version
"testing jest-26"
26.6.3
> test
> echo "testing jest-28" && jest --version
"testing jest-28"
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module 'jest-cli/bin/jest'
Require stack:
- C:\Users\user\Documents\npm-workspace-repro\jest-28\node_modules\jest\bin\jest.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\Users\user\Documents\npm-workspace-repro\jest-28\node_modules\jest\bin\jest.js:12:3)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\Users\user\Documents\npm-workspace-repro\jest-28\node_modules\jest\bin\jest.js:12:3)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\user\\Documents\\npm-workspace-repro\\jest-28\\node_modules\\jest\\bin\\jest.js'
]
}
Node.js v20.7.0
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: jest-28
npm ERR! at location: C:\Users\user\Documents\npm-workspace-repro\jest-28 These findings bring about the questions.
|
This looks like it's fixed as of 10.8.1. Please updated npm.
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Expected Behavior
Steps To Reproduce
git clone https://github.com/Maxim-Mazurok/npm-workspaces-repro
v18.3.0
andnpm@8.12.1
:nvm i 18.3.0
ornvs add 18.3.0 && nvs use 18.3.0
npm ci
npm test
Environment
The text was updated successfully, but these errors were encountered: