2016-08-14 15 views
0

我想創建我的電子應用程序的窗口安裝程序(以便它可以在任何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的

回答

2

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

相關問題