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

SyntaxError: Unexpected token 'with' when running repomix #274

Closed
kkailaasa opened this issue Jan 6, 2025 · 7 comments
Closed

SyntaxError: Unexpected token 'with' when running repomix #274

kkailaasa opened this issue Jan 6, 2025 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@kkailaasa
Copy link

When running repomix, the command fails with a SyntaxError related to the with keyword. This suggests a compatibility issue with newer Node.js versions or ESM modules.

Steps to Reproduce:
npx repomix

Error Output:

Fatal Error: {
  name: 'SyntaxError',
  message: "Unexpected token 'with'",
  stack: "SyntaxError: Unexpected token 'with'\n" +
    '    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)\n' +
    '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)'
}
@gaby
Copy link
Contributor

gaby commented Jan 7, 2025

Same issue I reported a few days here #206 (comment)

Ping @yamadashy

@yamadashy yamadashy added the bug Something isn't working label Jan 7, 2025
@yamadashy
Copy link
Owner

yamadashy commented Jan 7, 2025

Thank you for your report!

Sorry for the delay in confirming this.
I haven't been able to reproduce it yet, but I will try it in a few repositories and investigate.

@yamadashy yamadashy self-assigned this Jan 7, 2025
@yamadashy
Copy link
Owner

yamadashy commented Jan 7, 2025

It seems that the error might be caused by the recent update of cli-spinners, particularly due to this part:

import spinners from './spinners.json' with {type: 'json'};

https://github.com/sindresorhus/cli-spinners/blob/main/index.js#L1

PR

I suspect this change is causing compatibility issues. Unfortunately, I won't be able to address this today, but I will look into it tomorrow. Apologies for the inconvenience.

@yamadashy
Copy link
Owner

yamadashy commented Jan 8, 2025

Hi @kkailaasa and @gaby,

I've just released v0.2.17 which includes a fix for the with keyword compatibility issue. The error was occurring because [email protected] was using import assertions that aren't supported in Node.js < 18.20.0 and Node.js 19.x.
https://github.com/yamadashy/repomix/releases/tag/v0.2.17

Could you please try updating to v0.2.17 and let me know if this resolves the issue?

npm i -g repomix@latest
# or
npx repomix@latest

While the original report mentioned Node.js 20.x, this fix might help as it improves compatibility across Node.js versions. I've also expanded Node.js support to include all versions from 18.0.0 onwards.

Let me know if you still encounter any issues. Thanks for reporting this problem! 🙏

@kkailaasa
Copy link
Author

I can confirm this issue is resolved, thank you @yamadashy

@yamadashy
Copy link
Owner

@kkailaasa
Thank you so much for confirming the fix and for your detailed bug report! Your clear reproduction steps and error output were very helpful in addressing this issue.

@gaby
I apologize for the delay in fixing this issue that you reported earlier. Thank you for bringing this to our attention through #206! Your initial report helped us track down this problem. Really appreciate your contribution to making Repomix better!

@gaby
Copy link
Contributor

gaby commented Jan 9, 2025

@yamadashy Thank you for the awesome tool! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants