签名电子应用程序在OSX上不以robotjs开头(未处理的错误:找不到合适的图像)



我有一个经过签名和公证的应用程序,我想在其中使用robotjs来模拟按键敲击。我在本地构建robotjs没有问题,但当我通过CI运行它时,在那里我对应用程序进行签名和公证,应用程序在启动时会抛出以下错误:

electron/js2c/asar.js:140 Uncaught Error: dlopen(/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr, 1): no suitable image found.  Did find:
/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr: code signature in (/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr: stat() failed with errno=17
at process.func [as dlopen] (electron/js2c/asar.js:140)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1034)
at Object.func [as .node] (electron/js2c/asar.js:149)
at Module.load (internal/modules/cjs/loader.js:815)
at Module._load (internal/modules/cjs/loader.js:727)
at Function.Module._load (electron/js2c/asar.js:769)
at Module.require (internal/modules/cjs/loader.js:852)
at require (internal/modules/cjs/helpers.js:74)
at Object.<anonymous> (/Applications/w3champions-launcher.app/Contents/Resources/app.asar/node_modules/robotjs/index.js:1)
at Object.<anonymous> (/Applications/w3champions-launcher.app/Contents/Resources/app.asar/node_modules/robotjs/index.js:38)

我有一种感觉,我没有签署构建的robotjs东西,因此OSX在加载它时不高兴。如果我删除公证步骤,我会得到同样的错误。这些是我的构建命令:

"build": "npm run rebuild && vue-cli-service electron:build",
"rebuild": "npm rebuild --runtime=electron --target=9.1.2 --disturl=https://atom.io/download/atom-shell --abi=80",

我在这里发现了一些东西:https://github.com/electron-userland/electron-builder/issues/4040#issuecomment-543252275,但我缺乏实现这一目标的电子知识。此外,他还使用了react和2 package.json解决方案,这是我没有的。我必须为robotjs添加一个符号步骤吗?如果需要,我该怎么做?在Windows上,一切都很好,在签名和构建方面没有问题。

这将是回购:https://github.com/w3champions/w3champions-launcher

好吧,我无意中发现了一篇发生类似事情的帖子,并修复了它。在我的谷歌之旅中,我改变了以下事情,也许其中一件可能会对某人有所帮助:

vue.config.js中,我添加了builderOptions.mac.entitlementsInherit = "build/entitlements.mac.inherit.plist"。早些时候我只有builderOptions.mac.entitlements

我把这两个实体添加到我的实体列表中:

<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>

在包.json中,我将我的构建sightly更改为

"build": "npm run rebuild && vue-cli-service electron:build",
"rebuild": "npm rebuild --runtime=electron --target=9.1.2 -- disturl=https://atom.io/download/atom-shell --abi=80"

这个改动是为了使abi正确。您可以通过electron --abi获得所需的abi

相关内容

最新更新