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

运行报错 #40

Open
zwqco opened this issue Sep 12, 2023 · 9 comments
Open

运行报错 #40

zwqco opened this issue Sep 12, 2023 · 9 comments

Comments

@zwqco
Copy link

zwqco commented Sep 12, 2023

PS D:\gitWorkSpace\chatflow-main> npm run start

[email protected] start
cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm" node ./example/ding-dong-bot.ts

D:\gitWorkSpace\chatflow-main\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 (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\transpilers\swc.ts:262:13)
at createSwcOptions (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\transpilers\swc.ts:211:25)
at create (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\transpilers\swc.ts:56:41)
at createTranspiler (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\index.ts:784:16)
at createTranspileOnlyGetOutputFunction (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\index.ts:1341:28)
at createFromPreloadedConfig (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\index.ts:1404:34)
at create (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\index.ts:624:10)
at register (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\index.ts:591:15)
at Object.registerAndCreateEsmHooks (D:\gitWorkSpace\chatflow-main\node_modules\ts-node\src\esm.ts:116:34)
at file:///D:/gitWorkSpace/chatflow-main/node_modules/ts-node/esm.mjs:8:7

@atorber
Copy link
Owner

atorber commented Sep 12, 2023

尝试

  1. 运行以下指令
rm -rf node_modules package-lock.json
npm install

然后运行程序看是否可以启动,如果不行继续向下尝试

  1. 确保你的@swc/core和ts-node都是最新版本。你可以通过运行以下命令来更新它们:
npm update @swc/core ts-node

如果依然有问题,在此issues下回复

@zwqco
Copy link
Author

zwqco commented Sep 12, 2023

尝试

  1. 运行以下指令
rm -rf node_modules package-lock.json
npm install

然后运行程序看是否可以启动,如果不行继续进一步尝试

  1. 确保你的@swc/core和ts-node都是最新版本。你可以通过运行以下命令来更新它们:
npm update @swc/core ts-node

如果仍然有问题,在此issues下回复

尝试

  1. 运行以下指令
rm -rf node_modules package-lock.json
npm install

然后运行程序看是否可以启动,如果不行继续进一步尝试

  1. 确保你的@swc/core和ts-node都是最新版本。你可以通过运行以下命令来更新它们:
npm update @swc/core ts-node

如果还有问题,在此问题下回复

还是报这个错那

@atorber
Copy link
Owner

atorber commented Sep 12, 2023

npx ts-node --version

查看一下ts-node的版本号

@zwqco
Copy link
Author

zwqco commented Sep 12, 2023

npx ts-node --version

image

@zwqco
Copy link
Author

zwqco commented Sep 12, 2023

npx ts-node --version

查看一下ts-node的版本号

是不是ts-node和 swc/core版本不匹配 大佬

@atorber
Copy link
Owner

atorber commented Sep 12, 2023

看提示信息是这样的,我现在没有环境验证,可以再运行以下 npm update @swc/core ts-node 试试

@zwqco
Copy link
Author

zwqco commented Sep 12, 2023

npm update @swc/core ts-node

好的我再看下 谢谢

@atorber
Copy link
Owner

atorber commented Sep 12, 2023

npm i @swc/[email protected]

@atorber
Copy link
Owner

atorber commented Sep 12, 2023

由于@swc/core升级导致的一个bug,2.0.16之前需运行 npm i @swc/[email protected] 更新依赖,之后版本以修复此问题

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