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

Im trying to use grammy on my next.js project but whatever i do i get this #48

Open
MateoKappa opened this issue Apr 9, 2024 · 6 comments

Comments

@MateoKappa
Copy link

MateoKappa commented Apr 9, 2024

`npx ts-node scripts/build.ts

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mateokappa/Desktop/www/scripts/build.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
at defaultLoad (node:internal/modules/esm/load:141:22)
at async nextLoad (node:internal/modules/esm/hooks:865:22)
at async nextLoad (node:internal/modules/esm/hooks:865:22)
at async Hooks.load (node:internal/modules/esm/hooks:448:20)
at async MessagePort.handleMessage (node:internal/modules/esm/worker:196:18) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}`

@KnorpelSenf
Copy link
Member

How is this related to grammY?

@MateoKappa
Copy link
Author

The build script is from the next.js example from Grammy and I can't run it on my next JS project

@KnorpelSenf
Copy link
Member

AFAIK, you don't have to run this command anyway. It will be run automatically during build.

@PonomareVlad is there a way to run these things locally? Should we document it, given that people try it anyway?

@MateoKappa
Copy link
Author

It is also failing on vercel , basically I'm trying to fix it locally so it fixes while running on vercel as well

@PonomareVlad
Copy link
Member

ts-node doesn't support .ts extension ? 🌚

@keyding
Copy link
Contributor

keyding commented Sep 1, 2024

I had the same error, and switched from ts-node to tsx.

But if you want to use ts-node, see this issue: TypeStrong/ts-node#2100

Also, you can just use Bun, it's very fast.

You can do this: bun run scripts/build.ts, not required ts-node.

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

4 participants