{"id":19545174,"url":"https://github.com/scscms/nwjs","last_synced_at":"2026-06-18T07:31:25.506Z","repository":{"id":93555028,"uuid":"132731401","full_name":"scscms/NWjs","owner":"scscms","description":"nwjs是在英特尔开源技术中心创建的，它是基于谷歌浏览器核心引擎和nodejs运行，你可以通过nwjs技术使用html和js语言编写本地应用程序，它也可以让你直接从DOM调用nodejs模块，使用一种新的方式与所有的Web技术编写本地应用。","archived":false,"fork":false,"pushed_at":"2018-05-09T09:16:27.000Z","size":2272,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T05:42:51.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scscms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-09T09:10:02.000Z","updated_at":"2018-05-09T09:16:29.000Z","dependencies_parsed_at":"2023-10-02T08:04:14.794Z","dependency_job_id":null,"html_url":"https://github.com/scscms/NWjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scscms/NWjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scscms%2FNWjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scscms%2FNWjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scscms%2FNWjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scscms%2FNWjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scscms","download_url":"https://codeload.github.com/scscms/NWjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scscms%2FNWjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34481251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:35:58.939Z","updated_at":"2026-06-18T07:31:25.482Z","avatar_url":"https://github.com/scscms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NWjs学习\u003csup\u003eshine\u003c/sup\u003e\n\n### NWjs简介\n\nnwjs是在英特尔开源技术中心创建的，它是基于谷歌浏览器核心引擎和nodejs运行，你可以通过nwjs技术使用html和js语言编写本地应用程序，它也可以让你直接从DOM调用nodejs模块，使用一种新的方式与所有的Web技术编写本地应用。它主要有以下6个特点：\n\n- （1）以网络最流行的技术编写原生应用程序的新方法\n- （2）基于HTML5, CSS3, JS and WebGL而编写\n- （3）完全支持nodejs所有api及第三方模块\n- （4）可以使用DOM直接调用nodejs模块\n- （5）容易打包和分发\n- （6）支持运行环境包括32位和64位的Window、Linux和Mac OS\n\n\u003e 扩展：类似的框架还有[Electron](https://github.com/atom/electron \"Electron github\")和`Hex`。不过`Hex`已经没落，`Electron`比较火热。\n\n### 下载安装\n\n官方网站：[https://nwjs.io](https://nwjs.io/ \"NWjs官方网站\")\u003cbr/\u003e\n官方文档：[http://docs.nwjs.io](http://docs.nwjs.io/ \"NWjs官方文档\")\n\n* **v0.30.2:** (Apr 28, 2018, based off of Node.js v10.0.0, Chromium 66.0.3359.139): [release notes](https://nwjs.io/blog/v0.30.2/)  \n **NOTE** You might want the **SDK build**. Please read the release notes.\n * Linux: [32bit](https://dl.nwjs.io/v0.30.2/nwjs-v0.30.2-linux-ia32.tar.gz) / [64bit](https://dl.nwjs.io/v0.30.2/nwjs-v0.30.2-linux-x64.tar.gz)\n * Windows: [32bit](https://dl.nwjs.io/v0.30.2/nwjs-v0.30.2-win-ia32.zip) / [64bit](https://dl.nwjs.io/v0.30.2/nwjs-v0.30.2-win-x64.zip)\n * Mac 10.10+: [64bit](https://dl.nwjs.io/v0.30.2/nwjs-v0.30.2-osx-x64.zip)\n * Use [Legacy build](http://nwjs.io/downloads/) for Win XP and early OSX.\n\n请各自选择相应版本。本人开始使用的是win64，直到打包后发现不能运行，经查是[nw.js的一个坑](https://www.zhihu.com/question/39727034 \"nw.js版本是64位的打包exe在win10下和xp下执行不了\")，所以换32位就好了！\n\n\t\u003e另360杀毒软件会报病毒，请添加信任或关闭杀毒软件。我是简单卸载了。\n\n![NWjs](img/1.png \"NWjs解压后目录\")\n\n### 编写项目\n\n我们就地新建一个`app`文件夹，并在里面新建`package.json`文件\n```\n{\n  \"name\": \"nw-app\",\n  \"version\": \"0.0.1\",\n  \"main\": \"index.html\"\n}\n```\n并新建一个`index.html`文件\n```\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eHello World!\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eHello World!\u003c/h1\u003e\n    We are using node.js \u003cscript\u003edocument.write(process.version)\u003c/script\u003e.\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 运行项目\n\n直接把`app`文件夹拖到`nw.exe`上即可运行。或者管理员身份执行`cmd`命令：\n\n```\n$ nw app\n```\n\n![NWjs](img/2.png \"执行效果\")\n\n### 打包发布\n\n至此`NWjs`项目就可以预览了，但如果想发给别人就还必须打包生成执行文件。\n\n- 首先进入`app`文件夹选择所有文件打包成`app.zip`(特别强调是zip,不是rar)\n![NWjs](img/3.png \"打包界面\")\n- 然后重命名为`app.nw`再剪切到父级目录里。\n- 然后执行`CMD`命令:\n```\ncopy /b nw.exe+app.nw app.exe\n```\n![NWjs](img/4.png \"执行效果\")\n\n然后就可以直接运行`app.exe`文件了。但是不能复制到其他目录下运行，我们需要借助`Enigma Virtual Box`打成独立的可执行的exe文件。\n\n### 安装Enigma Virtual Box\n\n[下载Enigma Virtual Box](http://enigmaprotector.com/assets/files/enigmavb.exe \"点击下载\") 载完就直接安装。\n\n然后打开软件并切换到中文模式，首先选择“请选择待封包的主程”为我们项目中的`app.exe`，而“封包程序另存”为默认值。然后全选项目中除了`app/`,`app.exe`,`app.nw`,`credits.html`外的所有文件并拖入到`文件`框内。运行\"执行封包\"。\n![NWjs](img/5.png \"封包界面\")\n\n### 优化图标\n\n首先窗体左上角的图标是可以通过`package.json`文件配置\n```\n  \"window\": {\n    \"icon\": \"ico.png\",\n  }\n```\n但生成的应用程序的图标却是默认nwjs的，无法在代码中修改。下面我们就使用两款软件来修改此图标：[Resource Hacker](http://www.angusj.com/resourcehacker/ \"点击进入下载页面\") 和 [Axialis IconWorkshop](http://www.iconworkshop.cn/xiazai.html \"点击进入下载页面\")\n\n- 制作图标\n\n第一步要做的是制作ico图标，在windows系统中，可以设置“大图标”，\"中等图标\"和“小图标”等不同尺寸，所以，**一个ico文件实际上包含多个不同尺寸的图标**。\n\nIconWorkshop是一款收费软件，可以试用30天。\n使用Axialis IconWorkshop打开你的图片，点击左上角的图标，然后就可以选择你要生成的尺寸了。\n\n![IconWorkshop](img/6.png \"制作图标\")\n\n我做的时候选择了RGBA的各种尺寸图标，然后点击确定，然后保存就生成ico文件了。\n\n- 替换exe文件的图标\n\n下一步就是替换图标，使用Resource Hacker打开exe文件：\n![Hacker](img/7.png \"替换图标\")\n\n在`Icon Group`中右建`IDR_MAINFAME:1033`,选择`Replace Icon...`替换为上面制作的ico文件即可。替换完后另存为一下，就可以看到新图标了。\n\n### 后记\n替换图标后运行程序很可能报**“该程序不是有效的win32位应用程序”**，我们其实还有一招更好的方法：因为ico图标是继承`nw.exe`程序的，我们把`nw.exe`的图标换了不就更省事了，一劳永逸。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscscms%2Fnwjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscscms%2Fnwjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscscms%2Fnwjs/lists"}