我搜索了很多,但没有任何东西真正有助于将我的应用程序构建为可移植的。无论我做什么,结果总是 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 portable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50905886/