https://www.npmjs.com/package/electron-builder我的电子应用" /> https://www.npmjs.com/package/electron-builder我的电子应用 - 源码之家" />

构建找不到尝试使用电子建设者https://www.npmjs.com/package/electron-builder我的电子应用

问题描述:

我想创建我的电子应用程序的窗口安装程序(以便它可以在任何Windows计算机上作为独立的应用程序运行)创建一个安装程序时错误构建找不到尝试使用电子建设者<a href="https://www.npmjs.com/package/electron-builder" rel="nofollow">https://www.npmjs.com/package/electron-builder</a>我的电子应用

在我的电脑上输入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> <[email protected]>", 
    "license": "ISC", 
    "devDependencies": { 
    "electron": "^1.3.3", 
    "electron-installer-squirrel-windows": "^1.3.0", 
    "electron-packager": "^7.5.1" 
    } 
} 

我使用Windows 10,并通过bash的

electron-builder执行该命令没有安装。你不需要electron-installer-squirrel-windowselectron-packager, - 删除它,npm install electron-builder --save-dev

+0

谢谢你的工作!出于好奇,怎么来的NPM运行DIST只生产Linux文件夹,我想创建Windows安装程序,但它仅使用电子1.3.3到dist/linux的 – John

+0

'建立-mwl'(建立适用于MacOS应用程序包为平台的Linux的x64 ,Windows和Linux)。请参阅https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build – develar