Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos electron builder在windows上创建.dmg_Macos_Electron_Exe_Electron Builder_Dmg - Fatal编程技术网

Macos electron builder在windows上创建.dmg

Macos electron builder在windows上创建.dmg,macos,electron,exe,electron-builder,dmg,Macos,Electron,Exe,Electron Builder,Dmg,我想为windows、mac和linux创建我的electron应用程序安装程序,但目前它仅创建.exe文件: 还有一些赢解包目录和其他一些文件,我甚至不知道为什么我需要这些文件,因为.exe文件正在安装我的应用程序并创建桌面快捷方式,我甚至不需要这些额外的文件来让应用程序工作 换句话说,当我复制.exe并在另一台机器上运行时,它就成功地安装了,所以为什么我还需要这些其他文件呢 所以它可以在windows上正常工作,但它不会创建任何可以在macOS和linux上运行的文件,比如.dmg 这是

我想为windows、mac和linux创建我的electron应用程序安装程序,但目前它仅创建.exe文件:

还有一些赢解包目录和其他一些文件,我甚至不知道为什么我需要这些文件,因为.exe文件正在安装我的应用程序并创建桌面快捷方式,我甚至不需要这些额外的文件来让应用程序工作

换句话说,当我复制.exe并在另一台机器上运行时,它就成功地安装了,所以为什么我还需要这些其他文件呢


所以它可以在windows上正常工作,但它不会创建任何可以在macOS和linux上运行的文件,比如.dmg

这是我的package.json

{
  "name": "screenrecorder",
  "version": "1.0.0",
  "description": "Electron application to record screen",
  "main": "./src/js/main/index.js",
  "scripts": {
    "start": "electron ./src/js/main/index.js",
    "compile:sass": "node-sass src/style/scss/main.scss src/style/css/output.css -w",
    "build": "electron-builder"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/d0peCode/screenRecorder"
  },
  "build": {
    "appId": "screenrecorder",
    "mac": {
      "category": "your.app.category.type",
      "target": "dmg"
    }
  },
  "author": "Borys Tyminski",
  "license": "ISC",
  "homepage": "https://github.com/d0peCode/screenRecorder#readme",
  "dependencies": {
    "angular": "^1.6.5",
    "angular-route": "^1.6.5"
  },
  "devDependencies": {
    "electron": "^6.0.2",
    "electron-builder": "^21.2.0",
    "node-sass": "^4.9.2"
  }
}
这是我在运行
npm run build

C:\Users\Borys\Documents\work\screenRecorder\desktop>npm运行构建

screenrecorder@1.0.0构建>C:\Users\Borys\Documents\work\screenRecorder\desktop

电子建设者

•electron builder版本=21.2.0 os=10.0.18362

•加载的配置文件=package.json(“构建”字段)

•写入有效配置文件=dist\builder-effective-config.yaml

•打包平台=win32 arch=x64 electron=6.0.6 appOutDir=dist\win解包

•使用默认电子图标原因=未设置应用程序图标

•building target=nsis file=dist\screenrecorder Setup 1.0.0.exe archs=x64 oneClick=true perMachine=false

•构建块映射blockMapFile=dist\screenrecorder Setup 1.0.0.exe.blockmap


为什么它不创建macOS安装程序?要做到这一点,需要哪些步骤?

您不能在Windows上使用Electron构建macOS可执行文件,因为它需要Apple SDK和XCode工具。Linux可以工作,但您需要在构建配置中指定格式和体系结构

例如,要为ARMv7l CPU构建AppImage格式的Linux可执行文件,可以使用以下配置:

linux: {
    target: {
        target: 'appimage',
        arch: ['armv7l']
    }
}

有关Linux构建选项的完整文档如下。

您在开发中使用的操作系统是什么?我们还可以看到生成过程的日志输出吗?我使用windows 10,我将用日志编辑问题