使用nativefier将网页转为桌面应用

项目地址 https://github.com/jiahaog/nativefier

安装

安装Node.js https://nodejs.org/
开管理员权限终端 npm install nativefier -g

默认源有问题,需要更换,参考 https://www.jianshu.com/p/80add7cfef30
npm config set registry https://registry.npm.taobao.org
npm info underscore (如果上面配置正确这个命令会有字符串response)

使用

nativefier --name "StoreSystem" "http://storesystem.dmsdbj.com"
这是最简单的打包方式

其他参数如width height max-width max-height icon等,对应指定转换完成的应用长宽 最大长最大宽 图标
详见 https://github.com/jiahaog/nativefier/blob/master/docs/api.md
nativefier --max-width 360px --max-height 600px --name "integral" "https://tfjybj.com/integral"

在这里插入图片描述转换完成后的应用在C:\Windows\System32 下,找到.exe 文件就可以启动了

吐槽一下,转换出来的文件好大啊啊

缺点也有,就是前端页面更新一次就得重新封一次包……

进阶

文件夹里一堆.dll文件看的心烦怎么办?
这里我们使用Enigma Virtual Box 来封包 https://enigmaprotector.com/en/aboutvb.html
下载安装完成后打开,可以选择中文
选择好需要封包的主程序和另存的文件名
在下面的文件里添加依赖,这里建议选择增加文件夹(递归),不容易遗漏文件,封包前把之前选择的主程序移除即可
在这里插入图片描述
在这里插入图片描述在这里插入图片描述添加完成后执行封包
封包完成后就能在设定的地方找到单独的.exe文件啦

完事

发布了161 篇原创文章 · 获赞 63 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/sxhexin/article/details/89040649