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

[Bug]: [email protected] throws error Cannot find module 'temp' #956

Closed
1 task
trivikr opened this issue Oct 31, 2024 · 2 comments · Fixed by #957
Closed
1 task

[Bug]: [email protected] throws error Cannot find module 'temp' #956

trivikr opened this issue Oct 31, 2024 · 2 comments · Fixed by #957
Labels
bug Something isn't working p1 This is a high priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Oct 31, 2024

Self-service

  • I'd be willing to implement a fix

Describe the bug

[email protected] throws error Cannot find module 'temp'

Steps to reproduce

Follow example from README

$ cat example.ts 
import AWS from "aws-sdk";
const client = new AWS.DynamoDB();
const response = await client.listTables({}).promise();

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 example.ts 

Observed behavior

Error is thrown

Need to install the following packages:
[email protected]
Ok to proceed? (y) y

node:internal/modules/cjs/loader:1252
  throw err;
  ^

Error: Cannot find module 'temp'
Require stack:
- /Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/jscodeshift/dist/Runner.js
- /Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/aws-sdk-js-codemod/dist/cli.js
- /Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/aws-sdk-js-codemod/bin/aws-sdk-js-codemod
    at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at Object.<anonymous> (/Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/jscodeshift/dist/Runner.js:17:14)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Object..js (node:internal/modules/cjs/loader:1689:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/jscodeshift/dist/Runner.js',
    '/Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/aws-sdk-js-codemod/dist/cli.js',
    '/Users/trivikr/.npm/_npx/7c563efbb7515419/node_modules/aws-sdk-js-codemod/bin/aws-sdk-js-codemod'
  ]
}

Node.js v22.11.0

Expected behavior

No error is thrown

Environment

It's v2.4.0, but the error is thrown for detecting version too.


Need to install the following packages:
[email protected]
Ok to proceed? (y) y

Additional context

No response

@trivikr trivikr added bug Something isn't working triage Triaging bugs p1 This is a high priority issue and removed triage Triaging bugs labels Oct 31, 2024
@trivikr
Copy link
Member Author

trivikr commented Oct 31, 2024

This seems to be an issue with [email protected]

$ test-jscodeshift> npm install [email protected] --save-exact

$ test-jscodeshift> npx jscodeshift --version                  
jscodeshift: 17.1.0
 - babel: 7.26.0
 - babylon: 7.26.2
 - flow: 0.251.1
 - recast: 0.23.9

$ test-jscodeshift> grep -rnI 'temp' node_modules/jscodeshift/dist/Runner.js
node_modules/jscodeshift/dist/Runner.js:17:const temp = require('temp');
node_modules/jscodeshift/dist/Runner.js:193:            temp.open({ prefix: 'jscodeshift', suffix: ext }, (err, info) => {
node_modules/jscodeshift/dist/Runner.js:314:            temp.cleanupSync();

Bug report created at facebook/jscodeshift#638.
We'll downgrade to [email protected] in the meantime.

Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working p1 This is a high priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant