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
When building and running the examples locally, you may run into this JS decorator error if your env isn't set up properly.
If you try to run tsx bin/scratch.ts or any of the example executables directly like tsx examples/ai-sdk/weather.ts – without transpiling from TS to JS, you may get the following error:
node:internal/modules/run_main:115
triggerUncaughtException(
^
Error [TransformError]: Transform failed with 1 error:
/Users/tfischer/dev/modules/agentic/src/tools/search-and-crawl.ts:24:2: ERROR: Transforming JavaScript decorators to the configured target environment ("node22.2.0") is not supported yet
at failureErrorWithLog (/Users/tfischer/.nvm/versions/node/v22.2.0/lib/node_modules/tsx/node_modules/esbuild/lib/main.js:1651:15)
at /Users/tfischer/.nvm/versions/node/v22.2.0/lib/node_modules/tsx/node_modules/esbuild/lib/main.js:849:29
at responseCallbacks.<computed> (/Users/tfischer/.nvm/versions/node/v22.2.0/lib/node_modules/tsx/node_modules/esbuild/lib/main.js:704:9)
at handleIncomingPacket (/Users/tfischer/.nvm/versions/node/v22.2.0/lib/node_modules/tsx/node_modules/esbuild/lib/main.js:764:9)
at Socket.readFromStdout (/Users/tfischer/.nvm/versions/node/v22.2.0/lib/node_modules/tsx/node_modules/esbuild/lib/main.js:680:7)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
Node.js v22.2.0
This is because this project uses ECMAScript Decorators which are a stage-3 proposal and ECMAScript Decorator Metadata which is possibly also a stage-3 proposal, though thats less clear. Note that this project does not use TypeScript's unofficial legacy decorator support, which is why experimentalDecorators is not enabled.
Both TypeScript and esbuild support these modern decorators, but they're still propagating support across the ecosystem to various build tools, so if you want to contribute to this library, you'll need the latest versions of them. We use a pnpm override to ensure that all dependencies like tsx and vitest use the latest version of esbuild.
Once the project is transpiled to dist, the resulting JS code doesn't use this fancy syntax, so it should work with any modern JS runtime (e.g., node >= 18, bun, deno, etc).
As a workaround for testing things, you can either run npx tsx bin/scratch.ts or node --disable-warning=ExperimentalWarning --disable-warning=DeprecationWarning --loader ts-node/esm bin/scratch.ts`, both of which do roughly the same thing.
The text was updated successfully, but these errors were encountered:
Olá estou com esse mesmo problema porem a solução no meu caso não funcionou. Teria alguma outra forma de rodar a aplicação ?
(translation) Hello, I have the same problem but the solution in my case didn't work. Is there any other way to run the application?
@CASSIOSOUZA which version of node.js and are you using? Are you using tsx, and if so which version? Give me as much info as possible about your environment and how you're trying to run the built-in examples.
When building and running the examples locally, you may run into this JS decorator error if your env isn't set up properly.
If you try to run
tsx bin/scratch.ts
or any of the example executables directly liketsx examples/ai-sdk/weather.ts
– without transpiling from TS to JS, you may get the following error:This is because this project uses ECMAScript Decorators which are a stage-3 proposal and ECMAScript Decorator Metadata which is possibly also a stage-3 proposal, though thats less clear. Note that this project does not use TypeScript's unofficial legacy decorator support, which is why experimentalDecorators is not enabled.
Both
TypeScript
andesbuild
support these modern decorators, but they're still propagating support across the ecosystem to various build tools, so if you want to contribute to this library, you'll need the latest versions of them. We use a pnpm override to ensure that all dependencies liketsx
andvitest
use the latest version ofesbuild
.Once the project is transpiled to
dist
, the resulting JS code doesn't use this fancy syntax, so it should work with any modern JS runtime (e.g.,node
>= 18, bun, deno, etc).As a workaround for testing things, you can either run
npx tsx bin/scratch.ts
or node --disable-warning=ExperimentalWarning --disable-warning=DeprecationWarning --loader ts-node/esm bin/scratch.ts`, both of which do roughly the same thing.The text was updated successfully, but these errors were encountered: