wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
772 stars 342 forks source link

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 9 months ago

atorber commented 9 months ago

🚨 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 commented 9 months ago

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.