alex8088 / electron-vite

Next generation Electron build tooling based on Vite 新一代 Electron 开发构建工具,支持源代码保护
https://electron-vite.org
MIT License
3.56k stars 153 forks source link

怎样安装类似serialport的插件 #595

Open kerwinxu opened 3 months ago

kerwinxu commented 3 months ago

Describe the bug

我通过如下的方式创建项目

yarn create @quick-start/electron

创建完成后只修改了 electron.vite.config.mjs

  main: {
    plugins: [externalizeDepsPlugin({exclude:['serialport']})]
  },

然后运行 yarn add serialport 出现如下的错误

electron-builder install-app-deps
  • electron-builder  version=24.13.3
  • loaded configuration  file=C:\Users\kerwin\Desktop\新建文件夹\com_helper\electron-builder.yml
  • rebuilding native dependencies  dependencies=@serialport/bindings-cpp@12.0.1 platform=win32 arch=x64
  • rebuilding native dependency  name=@serialport/bindings-cpp version=12.0.1
  ⨯ cannot execute  cause=fork/exec C:\Users\kerwin\.yarn\releases\yarn-1.22.19.cjs: %1 is not a valid Win32 application.
                    command='C:\Users\kerwin\.yarn\releases\yarn-1.22.19.cjs' run install
                    workingDir=C:\Users\kerwin\Desktop\新建文件夹\com_helper\node_modules\@serialport\bindings-cpp
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

我想知道,类似这类c++库,应该怎么安装?我看了样例。

Electron-Vite Version

electron-vite/2.3.0 win32-x64 node-v20.16.0

Electron Version

v32.0.0

Vite Version

vite/5.4.2 win32-x64 node-v20.16.0

Validations