我使用基于yarn的插件系统(作为节点模块安装)构建了一个Electron应用程序,因为我不想强制用户安装node或npm .

一些插件依赖于具有postinstall脚本“node index.js”的模块 . 此脚本失败,因为节点不存在 .

由于Electron包含某些版本的节点,我认为将带有电子节点的目录添加到PATH,但我在打包的应用程序中找不到节点二进制文件 .

我错过了什么?你能想到其他任何解决方法吗?

我在mac上使用电子包装器 .

我不认为这与问题有关,但这里是安装功能的主要部分:

var modulePath = join(__dirname, '../', 'node_modules', 'yarn', 'bin', 'yarnpkg')
var args = ['add', `${plugin.name}@${plugin.version}`, '--json' ]
var child = fork(modulePath, args ,{ silent: true, cwd: this.pluginsPath })

过程信息:

{
  "PATH": "/usr/bin:/bin:/usr/sbin:/sbin",
  "versions": {
    "http_parser": "2.7.0",
    "node": "6.5.0",
    "v8": "5.3.332.45",
    "uv": "1.9.1",
    "zlib": "1.2.8",
    "ares": "1.10.1-DEV",
    "modules": "50",
    "openssl": "1.0.2h",
    "electron": "1.4.5",
    "chrome": "53.0.2785.113",
    "atom-shell": "1.4.5"
  }
}