gpt4 book ai didi

javascript - 尝试为我的 Electron 应用程序创建安装程序时生成未找到错误

转载 作者:太空宇宙 更新时间:2023-11-04 03:06:41 25 4
gpt4 key购买 nike

我正在尝试使用 Electron-builder https://www.npmjs.com/package/electron-builder 为我的 Electron 应用程序创建一个窗口安装程序(以便它可以作为独立应用程序在任何 Windows 计算机上运行)

在我的计算机上输入 npm run dist 时,遇到以下错误。

sh: 1: build: not found

npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! <NAME>@0.0.0 dist: `build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the <NAME>@0.0.0 dist script 'build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the <NAME>,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! build

下面是我的 package.json 文件的样子

{
"name": "<NAME>",
"version": "0.0.0",
"description": "[...]",
"main": "index.js",
"build": {
"appId": "test.321",
"app-category-type": "your.app.category.type",
"win": {
"iconUrl": "http://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png"
}
},
"scripts": {
"start": "electron main.js",
"postinstall": "install-app-deps",
"pack": "build --dir",
"dist": "build"
},
"author": "<NAME> <jon@gmail.com>",
"license": "ISC",
"devDependencies": {
"electron": "^1.3.3",
"electron-installer-squirrel-windows": "^1.3.0",
"electron-packager": "^7.5.1"
}
}

我使用的是 Windows 10,并通过 bash 执行命令

最佳答案

我正在关注this blogpost为了构建它,我遇到了同样的问题,我解决了它,将 build 替换为 electron-builder 命令,并删除过时的 category 字段名称。

"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron .",
"test": "echo \"Error: no test specified\" && exit 1",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},

关于javascript - 尝试为我的 Electron 应用程序创建安装程序时生成未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38944247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com