Nw.js was developed by the Node-webkit project.
In fact, a lot of things on the official website. But in view of search engine (Baidu, Google) The related articles, let people see very not understand. So decided to write down this article.
Official website: https://nwjs.io/
English Document: http://nwjs-cn.readthedocs.io/zh_CN/latest/index.html
What's 1.nw.js doing?
Official web-based explanation:
Nw.js is based on chromium and node. js. Nw.js can develop desktop applications through page technology, while invoking node. js code and modules. In the future, you can use Nw.js to easily make a page app into a desktop app.
Simply put, web technology is used to develop cross-platform PC desktop applications.
2.mac Environmental installation of the official website mode:
Open the official website, he will automatically detect the native environment, pop-up Mac OS version of the download:
All 2 of them need to be downloaded? Yes. The
normal has a Nwjs.app file for our final release. Of course, the document also said, you can use the automatic release method: Nwjs-builder Nw-builder (all through NPM installation). I use the manual release method here, it is necessary to download the normal file.
sdk what does this file do?
Finally, we put the extracted files into the application directory,
3.MAC environment installation on NPM mode:
If the above installation you have finished, this part can not look. Because this is another way to install it.
Installation of the environment in addition to the official website of the 2 files installed, in fact, there is NPM installation, but in the process of using the error found.
NPM install-g Nwjs
Stop itching we use the NW command directly, check the version:
Nw-v
Displays the 1.4.4.
To run the project:
NW/Project Directory
Result Error:
Cannot read property ' split ' of undefined at module.exports (/usr/local/lib/node_modules/nwjs/lib/old-version.js : 2:20) ...
Forget it, or use the official Internet installation method, see 2.
4.hello World
We create a new folder:
TEST_NW, inside 2 files:
Package.json file:
{ "name": "HelloWorld", "main": "Index.html"}
index.html file:
<! DOCTYPE html>
The development phase runs: the command line switches to the working directory Nw_test1, and then uses the SDK command:
/applications/nwjs-sdk-v0.29.3-osx-x64/nwjs.app/contents/macos/nwjs.
Right click on the program to check, so that you can easily debug
Packaging: Use the official web recommended way of ordinary file packaging, note that our environment is Mac OS:
First copy a copy of the normal Nwjs.app in the same class directory, and Nw_test1 parallel.
We find the Contents/resources directory by right-clicking on the contents of the display package. Then we change the Nw_test1 to Test.app.
Drag Test.app into this directory and you will find that the original Nwjs.app name has changed and become Nwjs.app. This is our final application. Double-click to open.
Getting Started with Mac Nwjs