-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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]: Module cache already has entry - /node_modules/yargs/build/lib/parse-command.js. #13008
Comments
I don't quite understand what's going on, but I was able to replicate this on my machine.
|
I'm getting the same error:
I think it's related to dynamic imports:
Update: The error went away by moving the dynamic import away from the root of the file, and into the code that uses the import:
however now the whole test suite hangs forever |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
@bameyrick sorry, missed this one! I get an error when trying to run $ npm run fetch
> [email protected] fetch
> ts-node src/fetch.ts
(node:11581) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/simen/repos/iso-3166-1-flags-sprite-generator/src/fetch.ts:1
import fetch from 'node-fetch';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1055:15)
at Module._compile (node:internal/modules/cjs/loader:1090:27)
at Module.m._compile (/Users/simen/repos/iso-3166-1-flags-sprite-generator/node_modules/ts-node/src/index.ts:1597:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Object.require.extensions.<computed> [as .ts] (/Users/simen/repos/iso-3166-1-flags-sprite-generator/node_modules/ts-node/src/index.ts:1600:12)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at phase4 (/Users/simen/repos/iso-3166-1-flags-sprite-generator/node_modules/ts-node/src/bin.ts:579:12) |
Never mind, seems like the step is not needed - I can reproduce 👍 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
fixes #4317 also upgrade jest to fix jestjs/jest#13008
Version
28.1.2
Steps to reproduce
yargs
npm i
npm run fetch
npm run test
Expected behavior
Jest should be able to run both sets of tests
Actual behavior
Module cache already has entry /iso-3166-1-flags-sprite-generator/node_modules/yargs/build/lib/parse-command.js. This is a bug in Jest, please report it!
error thrownAdditional context
No response
Environment
The text was updated successfully, but these errors were encountered: