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

electron升级后在Mac上报错:Exit code/ ENOENT. spawn /usr/bin/python ENOENT #64

Open
hunter-ji opened this issue May 27, 2022 · 2 comments
Labels
Electron electron 报错 日常报错解决

Comments

@hunter-ji
Copy link
Owner

报错

electron升级到当前最新版(13.0.0),却在mac上打包时报错,报错内容如下:

Exit code: ENOENT. spawn /usr/bin/python ENOENT

环境

  • macOS: 12.3.1
  • electron: 13.0.0
  • electron-builder: 23.0.3
  • vue-cli-plugin-electron-builder: 2.1.1

解决

package.json中添加如下:

{
  // ...
  "resolutions": {
    "vue-cli-plugin-electron-builder/electron-builder": "^23.0.3"
  }
  // ...
}

该问题是由于mac系统升级后默认python命令是指向python3的,但是vue-cli-plugin-electron-builder是要求python2的,但是electron-builder是支持的,所以此处指定其使用electron-builder v23.0.3版本。

网上还有另一种解决方案就是将python重新指向python2,这种方案对于系统来说侵入性太强。我也考虑过起一个python2的docker continer然后临时指向,但是这样每次写代码还要设置下环境就很麻烦。

总体来说,还是觉得当前这个方案最方便了。

参考文档

@hunter-ji hunter-ji added 报错 日常报错解决 Electron electron labels May 27, 2022
@duoluodexiaoxiaoyuan
Copy link

不管用

@hunter-ji
Copy link
Owner Author

已经过了很久了,前端的技术栈更新很快的。我在文中标明了是electron 13,现在稳定版已经33了😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electron electron 报错 日常报错解决
Projects
None yet
Development

No branches or pull requests

2 participants