我正在尝试使用electronic-builder构建一个电子应用程序,但出现错误“ sh:1:build:not found ...”。
我正在使用电子版6.0.6以及mysql,nodejs和jquery。有段时间我试图用electronic-packager和electronic-builder构建这个应用程序,但是却无处可去为Linux和Windows构建可分发的软件包。
我的Package.json文件
{
"name": "elec",
"version": "1.0.0",
"description": "Appname",
"author": "author <author@mail.com>",
"main": "main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron ./app",
"pack": "build --dir",
"dist": "build"
},
"build": {
"appId": "yourappid",
"category": "your.app.category.type",
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 240,
"y": 150,
"type": "link",
"path": "/Applications"
}
]
},
"linux": {
"target": [
"AppImage",
"deb"
]
},
"win": {
"target": "squirrel",
"icon": "build/icon.ico"
}
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^6.0.1",
"electron-builder": "^21.2.0",
"electron-rebuild": "^1.8.6"
},
"dependencies": {
"chart.js": "^2.8.0",
"ejs": "~1.0.0",
"electron-print": "^1.0.2",
"electron-store": "^4.0.0",
"electron-window-manager": "^1.0.6",
"express": "^4.17.1",
"express-session": "^1.16.2",
"mysql": "github:mysqljs/mysql",
"python-shell": "^1.0.8"
}
}
答案 0 :(得分:0)
根据您所说的命令,在注释中,我认为您正在混淆电子制造商和电子包装商。后者不需要package.json中的那些脚本条目(所以我不知道该命令如何给您看到错误)。
但是,如果您使用的是电子生成器,我认为这是一个简单的复制粘贴错误。请参见https://github.com/electron-userland/electron-builder#quick-setup-guide,在“脚本”部分中,您应该具有:
"pack": "electron-builder --dir",
"dist": "electron-builder"
但是你有
"pack": "build --dir",
"dist": "build"
这就是为什么错误消息显示“内部版本:未找到”的原因。
顺便说一句,说明要求您使用yarn dist
或yarn pack
来运行它。