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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: @swc/core threw an error when attempting to validate swc compiler options. You may be using an old version of swc which does not support the options used by ts-node. Try upgrading to the latest version of swc. #298

Open
atorber opened this issue Sep 12, 2023 · 1 comment

Comments

@atorber
Copy link

atorber commented Sep 12, 2023

馃毃 The issue tracker is not for questions 馃毃

If you have a question, please ask it on https://stackoverflow.com/questions/tagged/wechaty

[question]

cross-env WECHATY_LOG=verbose WECHATY_PUPPET=wechaty-puppet-wechat npm start

wechaty-getting-started@1.18.9 start
cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm" node examples/ding-dong-bot.ts

/workspace/getting-started/node_modules/ts-node/src/transpilers/swc.ts:262
throw new Error(
^
Error: @swc/core threw an error when attempting to validate swc compiler options.
You may be using an old version of swc which does not support the options used by ts-node.
Try upgrading to the latest version of swc.
Error message from swc:
Failed to deserialize buffer as swc::config::Options
JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"commonjs","strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"decorators":true,"dynamicImport":true,"importAssertions":true},"target":"es2022","transform":{"decoratorMetadata":true,"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":true,"experimental":{"keepImportAssertions":true}}}

Caused by:
unknown field keepImportAssertions, expected one of plugins, keepImportAttributes, emitAssertForImportAttributes, cacheRoot, disableBuiltinTransformsForInternalTesting at line 1 column 438
at createVariant (/workspace/getting-started/node_modules/ts-node/src/transpilers/swc.ts:262:13)
at createSwcOptions (/workspace/getting-started/node_modules/ts-node/src/transpilers/swc.ts:211:25)
at create (/workspace/getting-started/node_modules/ts-node/src/transpilers/swc.ts:56:41)
at createTranspiler (/workspace/getting-started/node_modules/ts-node/src/index.ts:784:16)
at createTranspileOnlyGetOutputFunction (/workspace/getting-started/node_modules/ts-node/src/index.ts:1341:28)
at createFromPreloadedConfig (/workspace/getting-started/node_modules/ts-node/src/index.ts:1404:34)
at create (/workspace/getting-started/node_modules/ts-node/src/index.ts:624:10)
at register (/workspace/getting-started/node_modules/ts-node/src/index.ts:591:15)
at Object.registerAndCreateEsmHooks (/workspace/getting-started/node_modules/ts-node/src/esm.ts:116:34)
at file:///workspace/getting-started/node_modules/ts-node/esm.mjs:8:7
gitpod@wechaty-gettingstarted-rq1rpajqpla:/workspace/getting-started$

@monkfromearth
Copy link

If this is of any help, in an unrelated project, the dependency @swc/core on version 1.3.84 is breaking with these exact errors. Probably some new configurations, that haven't been documented yet. But, it works well for @swc/core@1.3.82.

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

2 participants