You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React前端运行报错[plugin:vite:react-swc] Bindings not found求助

解决Vite+React-SWC的「Bindings not found」报错

报错信息

运行React应用时出现:

[plugin:vite:react-swc] Bindings not found

调用栈关键路径:
C:/Users/jonus/OneDrive/Desktop/real-estate-app/client/src/main.jsx
涉及@swc/core和@vitejs/plugin-react-swc相关调用

解决办法

  • 清理依赖重新安装

    1. 删除node_modules文件夹和package-lock.json/yarn.lock
    2. 运行npm install或者yarn install重新安装依赖
    3. 重启Vite服务
  • 对齐SWC相关依赖版本
    版本不匹配是常见诱因,尝试重新安装最新兼容版本:

    npm uninstall @swc/core @vitejs/plugin-react-swc
    npm install @vitejs/plugin-react-swc@latest @swc/core@latest
    
  • 修复Windows环境特殊问题
    你的项目放在OneDrive同步文件夹,容易引发文件冲突,建议移到本地普通目录(比如C:\Projects\real-estate-app);另外可以:

    • 用管理员权限打开命令行操作
    • 安装Windows构建工具:npm install -g windows-build-tools(需管理员权限)
  • 临时切换到Babel插件
    如果以上方法无效,可替换SWC为Vite官方Babel插件:

    1. 卸载SWC插件:npm uninstall @vitejs/plugin-react-swc
    2. 安装Babel插件:npm install @vitejs/plugin-react
    3. 修改vite.config.js/vite.config.ts:
      import { defineConfig } from 'vite'
      import react from '@vitejs/plugin-react'
      
      export default defineConfig({
        plugins: [react()]
      })
      

内容的提问来源于stack exchange,提问作者Jonus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 19:16:00