踩坑系列
背景: 在做一个基于electron的一键报税的项目踩过的坑
注:我会持续更新
electron不支持xp
之前有客户使用打包后的electron程序(一键报税),弹出 不是有效的win32程序
第一感觉是系统环境问题,于是google,将得到的方案去尝试无果,于是去github上的electron项目去查找issue,发现了这样的回答
@likenamehaojie Chromium dropped support for Windows XP a long time ago and therefore Electron cannot continue supporting it.Even Microsoft no longer supports the majority of XP installs
felixrieseberg commented on 24 May 2016
Yep, sorry to say that this is a clear “wontfix” from the Electron team.
可自行去electron项目issue搜索xp
electron打印及预览
在查看官方文档后,你会发现BrowserWindow1
2
3
4
5
6
7
8
9win.loadURL(url[, options])
url String
options Object (optional)
httpReferrer String (optional) - A HTTP Referrer url.
userAgent String (optional) - A user agent originating the request.
extraHeaders String (optional) - Extra headers separated by “\n”
postData (UploadRawData[] | UploadFile[] | UploadFileSystem[] | UploadBlob[]) - (optional)
baseURLForDataURL String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified url is a data url and needs to load other files.
Same as webContents.loadURL(url[, options]).
通过淘宝镜像安装electron失败
例如这样:
通过给出的链接访问并不存在,那么到淘宝镜像官网查询得出原来是地址出错了。下面给出解决方案
windows
1 | set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ |
设置环境变量
mac or linux
1 | export ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" |
重新npm i 你会发现无比畅爽