简体   繁体   English

无法 package electron 应用

[英]Cannot package electron application

I am unable to package my electron app using electron packager.我无法使用 electron 打包程序 package 我的 electron 应用程序。 I have installed electron packager by running the command npm install electron-packager --save-dev .我通过运行命令npm install electron-packager --save-dev安装了 electron 打包器。 I run electron-pacakger.我运行电子包装器。 command to package my application, but got this error again and again.命令 package 我的应用程序,但一次又一次地收到此错误。 Here is a screenshot of this: screenshot of error from cmd这是一个截图: cmd 的错误截图

Note : I am using windows 10. My app runs on this OS by running command npm start just I cannot package it.注意:我正在使用 windows 10。我的应用程序通过运行命令npm start在此操作系统上运行,只是我不能 package 它。

Here is package.json file:这是 package.json 文件:

 { "name": "demo", "version": "1.0.0", "description": "", "main": "main.js", "scripts": { "start": "electron." }, "author": "", "license": "ISC", "devDependencies": { "electron": "^8.2.1", "electron-packager": "^14.2.1" } }

Please help me.请帮我。

I don't see a script to call electron-packager – so I am confused about what you are trying to do.我没有看到调用electron-packager的脚本——所以我对你想要做什么感到困惑。 It doesn't just happen by itself – you need to tell it what to do.它不会自己发生——你需要告诉它该做什么。 Here is the (edited) scripts section from a project I am working on.这是我正在处理的项目中的(已编辑)脚本部分。 Assumes you have a directory named "release-builds" at the same level as the package.json file as specified by this line --out=release-builds"假设您有一个名为“release-builds”的目录,与该行指定的package.json文件处于同一级别--out=release-builds"

 "scripts": {
    "start": "electron .",
    "package-mac": "electron-packager . --overwrite  --platform=darwin --arch=x64  --prune=true --out=release-builds",
    "package-win": "electron-packager . --overwrite  --platform=win32 --arch=x64   --prune=true --out=release-builds",
    "pack": "build --dir",
    "dist": "electron-builder -mw"
  },

And you would call it in the terminal through:您可以通过以下方式在终端中调用它:

npm run package-mac
npm run package-win

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM