Npm ';构建';无法识别为内部或外部命令-使用ElectronJS/electron builder
我最近与electron builder一起将我的electronJS应用程序更新为更高版本。 我在运行带有“npm start”的应用程序时没有任何问题,但是当我尝试使用electron builder构建应用程序时,在运行“npm run dist”时出现以下错误: $npm跑步区 myapp@1.0.0地区C:\Projects\myapp 建造 “构建”未被识别为内部或外部命令,可操作 程序或批处理文件。npm错误!代码ELIFECYCLE npm ERR!errno 1 npm 犯错误myapp@1.0.0距离:Npm ';构建';无法识别为内部或外部命令-使用ElectronJS/electron builder,npm,electron,electron-builder,Npm,Electron,Electron Builder,我最近与electron builder一起将我的electronJS应用程序更新为更高版本。 我在运行带有“npm start”的应用程序时没有任何问题,但是当我尝试使用electron builder构建应用程序时,在运行“npm run dist”时出现以下错误: $npm跑步区 myapp@1.0.0地区C:\Projects\myapp 建造 “构建”未被识别为内部或外部命令,可操作 程序或批处理文件。npm错误!代码ELIFECYCLE npm ERR!errno 1 npm 犯错误
build
npm错误!退出状态1 npm错误!npm
犯错误失败myapp@1.0.0dist脚本。npm错误!这可能是
npm没有问题。可能还有其他日志输出
上面
npm错误!此运行的完整日志可在以下位置找到:npm ERRC:\Users\User\AppData\Roaming\npm-cache\u logs\2019-12-05T11\u 35\u 33\u 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"
}
}
"scripts": {
"pack": "electron-builder --dir",
"dist": "electron-builder"
}
节点版本:12.13.1
npm版本:6.12.1更新后,我在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"
}
}
"scripts": {
"pack": "electron-builder --dir",
"dist": "electron-builder"
}
据此: