bash 尝试为我的电子应用程序创建安装程序时未找到构建错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38944247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Build not found error when trying to create an installer for my electron app
提问by John
I am trying to create a window installer for my electron app (so that it can be run on any windows computer as a standalone app) using electron-builder https://www.npmjs.com/package/electron-builder
我正在尝试使用电子构建器为我的电子应用程序创建一个窗口安装程序(以便它可以作为独立应用程序在任何 Windows 计算机上运行)https://www.npmjs.com/package/electron-builder
When typing npm run dist
on my computer, i run into the following error.
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
Below is how my package.json file looks
下面是我的 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> <[email protected]>",
"license": "ISC",
"devDependencies": {
"electron": "^1.3.3",
"electron-installer-squirrel-windows": "^1.3.0",
"electron-packager": "^7.5.1"
}
}
I am using windows 10, and executing the command via bash
我正在使用 Windows 10,并通过 bash 执行命令
回答by develar
electron-builder
is not installed. You don't need electron-installer-squirrel-windows
and electron-packager
, — remove it and npm install electron-builder --save-dev
electron-builder
未安装。你不需要electron-installer-squirrel-windows
and electron-packager
, — 删除它 andnpm install electron-builder --save-dev