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

Error: Cannot find module 'core-js/modules/es6.object.to-string.js' #205

Open
bennycode opened this issue Mar 18, 2021 · 2 comments
Open

Comments

@bennycode
Copy link

Hello, I installed jest-codemods (v0.23.0) globally and ran the following command:

npx jest-codemods ./test/unit_tests/event/EventRepositorySpec.js

Afterwards I got to see this error:

jest-codemods ./test/unit_tests/event/EventRepositorySpec.js
? Which parser do you want to use? TypeScript & TSX
? Which test library would you like to migrate from? Jasmine: globals
? Are you using the global object for assertions (i.e. without requiring them) Yes, and I'm not afraid of false positive transformations
? Will you be using Jest on Node.js as your test runner? Yes, use the globals provided by Jest (recommended)

NOTICE: Skipping import detection, you might get false positives
Executing command: jscodeshift -t C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\dist\transformers\jasmine-globals.js ./test/unit_tests/event/EventRepositorySpec.js --ignore-pattern node_modul
es --parser tsx --extensions=tsx,ts --skipImportDetection=true
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'core-js/modules/es6.object.to-string.js'
Require stack:
- C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\dist\utils\consts.js
- C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\dist\utils\finale.js
- C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\dist\transformers\jasmine-globals.js
- C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\node_modules\jscodeshift\src\Worker.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\dist\utils\consts.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._compile (C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\node_modules\pirates\lib\index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.newLoader [as .js] (C:\Users\bn\AppData\Roaming\nvm\v14.13.1\node_modules\jest-codemods\node_modules\pirates\lib\index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\bn\\AppData\\Roaming\\nvm\\v14.13.1\\node_modules\\jest-codemods\\dist\\utils\\consts.js',
    'C:\\Users\\bn\\AppData\\Roaming\\nvm\\v14.13.1\\node_modules\\jest-codemods\\dist\\utils\\finale.js',
    'C:\\Users\\bn\\AppData\\Roaming\\nvm\\v14.13.1\\node_modules\\jest-codemods\\dist\\transformers\\jasmine-globals.js',
    'C:\\Users\\bn\\AppData\\Roaming\\nvm\\v14.13.1\\node_modules\\jest-codemods\\node_modules\\jscodeshift\\src\\Worker.js'
  ]
}
All done.
Results:
0 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 2.514seconds

Here is the file which I tried to convert:

Am I holding it wrong?

@skovhus
Copy link
Owner

skovhus commented Apr 13, 2021

It seems like jscodeshift depends on core-js through babel-register, but still is not installed.

Which version of node are you using?

@tleunen
Copy link

tleunen commented Apr 26, 2022

Just installed codemods (0.26.1) and I'm facing a similar error, although with @babel/runtime-corejs2. Maybe related?

Error: Cannot find module '@babel/runtime-corejs2/core-js/set'
Require stack:
- /Users/ccsdf/.volta/tools/image/packages/jest-codemodmods/lib/node_modules/jest-codemods/node_modules/pirates/lib/index.js:136:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Object.newLoader [as .js] (/Users/tommy.leunen/.volta/tools/image/packages/jest-codemods/lib/node_modules/jest-codemods/node_modules/pirates/lib/index.js:141:7)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'MODULE_NOT_FOUND',

Both from npx jest-codemods and by installing it globally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants