解决方案:锁定swc版本
"overrides": {
"@swc/core": "1.3.42"
}
需要删除lockfile和node_modules重新安装
参考:https://github.com/NervJS/taro/issues/13544#issuecomment-1491488805
报错如下
Error: Bindings not found
at Compiler.transformSync (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+core@1.3.23\node_modules\@swc\core\index.js:250:15)
at Object.transformSync (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+core@1.3.23\node_modules\@swc\core\index.js:348:21)
at compile (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+register@0.1.10_@swc+core@1.3.23\node_modules\@swc\register\lib\node.js:76:22)
at compileHook (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+register@0.1.10_@swc+core@1.3.23\node_modules\@swc\register\lib\node.js:91:16)
at Module._compile (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+pirates@4.0.6\node_modules\pirates\lib\index.js:113:29)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.newLoader [as .js] (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+pirates@4.0.6\node_modules\pirates\lib\index.js:121:7)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
Error: Bindings not found
at Compiler.transformSync (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+core@1.3.23\node_modules\@swc\core\index.js:250:15)
at Object.transformSync (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+core@1.3.23\node_modules\@swc\core\index.js:348:21)
at compile (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+register@0.1.10_@swc+core@1.3.23\node_modules\@swc\register\lib\node.js:76:22)
at compileHook (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@swc+register@0.1.10_@swc+core@1.3.23\node_modules\@swc\register\lib\node.js:91:16)
at Module._compile (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+pirates@4.0.6\node_modules\pirates\lib\index.js:113:29)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.newLoader [as .js] (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+pirates@4.0.6\node_modules\pirates\lib\index.js:121:7)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
D:psntaro-testnode_modules.pnpmregistry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40node_modules@tarojsservicedistutilsindex.js:89
throw new Error(`插件依赖 "${item}" 加载失败,请检查插件配置`);
^
Error: 插件依赖 "D:psntaro-testnode_modules.pnpmregistry.npmmirror.com+@tarojs+cli@3.6.8_vue@3.2.40node_modules@tarojsclidistpresetsindex.js" 加载失败,请检查插件配置
at apply (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\utils\index.js:89:31)
at Kernel.initPreset (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:117:38)
at Kernel.resolvePresets (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:92:18)
at Kernel.initPresetsAndPlugins (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:86:14)
at Kernel.<anonymous> (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:306:18)
at Generator.next (<anonymous>)
at D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:8:71
at new Promise (<anonymous>)
at __awaiter (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:4:12)
at Kernel.run (D:\psn\taro-test\node_modules\.pnpm\registry.npmmirror.com+@tarojs+service@3.6.8_vue@3.2.40\node_modules\@tarojs\service\dist\Kernel.js:290:16)
Node.js v18.17.1