我最近将我的electronJS应用程序与electron-builder一起更新为更高版本。 我在使用“ npm start”运行应用程序时没有问题,但是当我尝试使用电子生成器构建应用程序时,在运行“ npm run dist”时出现以下错误:
$ npm run dist
myapp@1.0.0 dist C:\ Projects \ myapp 建立
'build'不被识别为内部或外部命令,可操作 程序或批处理文件。 npm ERR!代码ELIFECYCLE npm ERR! errno 1下午 呃! myapp@1.0.0 dist:
build
npm ERR!退出状态1 npm ERR! npm 呃!在myapp@1.0.0 dist脚本上失败。 npm ERR!这可能是 npm没问题。可能还有其他日志记录输出 以上。npm错误!有关此运行的完整日志,请参见:npm ERR!
C:\ Users \ User \ AppData \ Roaming \ npm-cache_logs \ 2019-12-05T11_35_33_988Z-debug.log
package.json:
{
"name": "myapp",
"version": "1.1.0",
"description": "none",
"main": "main.js",
"scripts": {
"start": "electron .",
"dist": "build",
"postinstall": "electron-builder install-app-deps"
},
"build": {
"appId": "Myapp.com",
"asar": true,
"asarUnpack": [
"configuration/**/*",
"output/**/*",
"appdata/**/*",
"node_modules/easy-pdf-merge/**/*"
]
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "ISC",
"homepage": "",
"dependencies": {
"axios": "^0.19.0",
"cryptr": "^6.0.1",
"easy-pdf-merge": "^0.2.0",
"edit-json-file": "^1.2.0",
"electron-log": "^3.0.9",
"electron-updater": "^4.2.0",
"eslint": "^5.12.0",
"exceljs": "^1.6.3",
"googleapis": "^27.0.0",
"mustache": "^3.0.1",
"node-localstorage": "^2.1.5",
"npm": "^6.5.0",
"pdf-table-extractor": "^1.0.3",
"popper.js": "^1.15.0",
"sqlite3": "^4.0.4",
"tippy.js": "^4.3.4",
"universal-analytics": "^0.4.20",
"uuid": "^3.3.3",
"webpack": "^4.28.0",
"winston": "^3.1.0"
},
"devDependencies": {
"electron": "^7.1.3",
"electron-builder": "^21.2.0"
}
}
节点版本:12.13.1 npm版本:6.12.1
答案 0 :(得分:0)
更新后,我在package.json中错过了以下内容:
"scripts": {
"pack": "electron-builder --dir",
"dist": "electron-builder"
}