我进行了很多搜索,但并没有真正帮助我构建可移植的应用程序。不管我做什么,总会得到一个nsis。
它遵循package.json:
{
"name": "pvmplayer",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron .",
"pack": "build --dir",
"dist": "build"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ajv": "^6.5.1",
"electron": "^2.0.2",
"electron-builder": "^20.15.1"
},
"optionalDependencies": {},
"dependencies": {},
"electronBuilder": {
"build": {
"productName": "PVM Player",
"appId": "scripter.PVMplayer",
"win": {
"target": ["portable"]
},
"directories": {
"output": "electron/output",
"app": "electron/app",
"buildResources": "electron/buildResources"
}
}
}
}
有什么好的指南可以遵循吗?
最佳答案
尝试将"win": { "target": ["portable"] }
和"portable": { "artifactName": "pvmplayer_portable.exe" }
放入"build"
中,可移植文件将被创建为pvmplayer_portable.exe
:
{
"name": "pvmplayer",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron .",
"pack": "build --dir",
"dist": "build"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ajv": "^6.5.1",
"electron": "^2.0.2",
"electron-builder": "^20.15.1"
},
"optionalDependencies": {},
"dependencies": {},
"build": {
"productName": "PVM Player",
"appId": "scripter.PVMplayer",
"win": {
"target": ["portable"]
},
"portable": {
"artifactName": "pvmplayer_portable.exe"
},
"directories": {
"output": "electron/output",
"app": "electron/app",
"buildResources": "electron/buildResources"
}
}
}
关于node.js - 我正在尝试将 Electron 应用程序转换为Windows便携式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50905886/