运行使用先打包成win32程序,在win7上运行exe启动。
electron app脚本中写下:
win.on('show',()=>{
let feedurl=`http://10.8.3.31:1337/update/windows_32/stable`;
autoUpdater.setFeedURL(feedurl);
autoUpdater.checkForUpdates(); // <------ 调用这里出错,没有进行网络连接就出错了
});
其中1337是连接的我本机的ip,跑的electron官方说明里的electron-release-servermaster
服务,也配置并测试了api正常
查看stackoverflow上给出的解释是这个app没有被安装 https://github.com/electron/electron/issues/4535 但,实际上我用inno setup 打包并安装之后安装也是同样的问题。
哪位给解释一下怎么回事
On Windows, you have to install your app into a user’s machine before you can use the autoUpdater, so it is recommended that you use the electron-winstaller, electron-builder or the grunt-electron-installer package to generate a Windows installer.
The installer generated with Squirrel will create a shortcut icon with an Application User Model ID in the format of com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE, examples are com.squirrel.slack.Slack and com.squirrel.code.Code. You have to use the same ID for your app with app.setAppUserModelId API, otherwise Windows will not be able to pin your app properly in task bar.
The server-side setup is also different from macOS. You can read the documents of Squirrel.Windows to get more details.
http://electron.atom.io/docs/api/auto-updater/
没用过autoUpdater,但是inno setup和electron-winstaller打包出来的安装文件安装方式不一样(electron-winstaller是直接就装上了,完全没有提示).可以参见官方的electron-api-demos,里面有个script/installer.js