问题
Is there a way to ask custom installation path to the user during electron app installation?
回答1:
Even if I set allowToChangeInstallationDirectory to true, compiled installer was not giving me the opportunity select the path. I found that my modules were outdated. After an update I managed to get what I wanted. So If you have any problem make sure that your modules are supporting recent updates
Another important issue is setting your package.json correctly. if you are using nsis and doing it on windows machne you need to declare something below in the package.json.
"win": {
"icon": "build/icon.ico",
"target": "nsis"
},
"nsis": {
"allowElevation": false,
"allowToChangeInstallationDirectory": true,
"oneClick": false,
"perMachine": true
},
回答2:
It appears there is a way via electron-builder's allowToChangeInstallationDirectory
flag
来源:https://stackoverflow.com/questions/45661129/how-to-set-a-custom-path-for-electron-app-installer