环境要求

  • macOS 10.10+ / Windows / Linux

  • Node.js ≥ 12.9 和 npm ≥ 6.9

博主以Centos7 安装Nodejs并演示

1
2
3
yum install epel-release
yum install nodejs
yum install npm --enablerepo=epel

安装成后,验证是否正确的安装,node -v,如果输出如下版本信息,说明成功安装

1
2
3
4
[root@localhost ~]# node -v
v16.18.1
[root@localhost ~]# npm -v
8.19.2

安装

1
npm install nativefier -g

用法

以我的博客网站kflag.top创建本机桌面应用程序:

1
2
3
nativefier "https://kflag.top"
# Centos7下制作exe
nativefier "https://kflag.top" --platform "windows"

如果需要,可以通过在命令行选项中指定其他选项:

1
2
nativefier "https://kflag.top" --platform "windows"  --icon "/root/favicon.png"
#When packaging for Linux, must be a path to a file..png

image-20230211191510838

效果

image-20230211193220406

详细用法

阅读API文档(或nativefier –help)以获取可用于配置打包应用程序的其他命令行标志和选项。

API文档