You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ USE_MOCKS=true && jest --detectOpenHandles
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/string-width/index.js from /home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/cliui/build/index.cjs:291:21)
at Object.<anonymous> (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/yargs/build/index.cjs:1:60678)
at Object.<anonymous> (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/yargs/index.cjs:5:30)
at _yargs (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/jest-cli/build/run.js:30:39)
at buildArgv (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/jest-cli/build/run.js:149:26)
at Object.run (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/jest-cli/build/run.js:124:24)
at Object.<anonymous> (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/jest-cli/bin/jest.js:16:17)
at Object.<anonymous> (/home/druf/Schreibtisch/projects/project-name/01-Backend/node_modules/jest/bin/jest.js:12:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn why string-width tells me, that it probably comes from @fastify/static. forceESM is not set by us. Not sure why this happens.
yarn why string-width
yarn why v1.22.19
[1/4] Why do we have the module "string-width"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "string-width@5.1.2"
info Reasons this module exists
- "@fastify#static#glob#jackspeak#@isaacs#cliui" depends on it
- Hoisted from "@fastify#static#glob#jackspeak#@isaacs#cliui#string-width"
- Hoisted from "@fastify#static#glob#jackspeak#@isaacs#cliui#wrap-ansi#string-width"
info Disk size without dependencies: "172KB"
info Disk size with unique dependencies: "308KB"
info Disk size with transitive dependencies: "328KB"
info Number of shared dependencies: 4
Done in 0.30s.
Your Environment
node version: 18.19.1
fastify version: 4.26.2
os: Linux
fastify-static version: 7.0.1
The text was updated successfully, but these errors were encountered:
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
Thanks for your swift reply @mcollina. I will have to invest some time for that, since this is a project that was created by another company and we are currently just maintaining it (doing upgrades). So I will have to dive a bit deeper and check which test file causes this.
In general the whole setup is a bit more complex since it involves multiple plugins and a distributed file structure.
馃挰 how to resolve the cjs error
When I run jest in my project, I get an error:
yarn why string-width
tells me, that it probably comes from@fastify/static
.forceESM
is not set by us. Not sure why this happens.Your Environment
The text was updated successfully, but these errors were encountered: