Install the node
For Windows, go to the Node official website to download the long-supported version or the latest stable version.
Use to manage and install Nw.js
npm install -g nrm # to set the NPM mirror addressNPM install -g NWJS is used to manage the nw.js versionCopy the code
Set the ADDRESS of the NPM image library
Use NRM to switch the mirror address:
nrm ls
nrm test Test which mirror address has the shortest access time
nrm use taobao # Change the mirror address
Copy the code
Go to the current user directory on drive C and find the. NPMRC file. Open it with an editor
home=https://npm.taobao.org
registry=https://registry.npm.taobao.org/
# Add the following line to save
nwjs_urlbase=https://npm.taobao.org/mirrors/nwjs/
Copy the code
You can use NW to download nw.js and run desktop applications
Copy a project :(github.com/otelnov/fil…) [Find a NW project on Gitbub]
Download SDK NW during development
NPM view NW versions View all versions NW install 0.14.1 NW install 0.14.1- SDK NW install 0.37.1- SDK NW install 0.37.1 NW LS NW Use 0.37.1 - SDKcd /project_path/ Enter the project directory
nw .
Copy the code
-
You can right-click on the window to check for debugging.
-
You can add script to index. HTML
const win = nw.Window.get(); win.enterFullscreen(); * * * * * * * * * * * * * * * * * * * * * * * * * * * * * win.setAlwaysOnTop(true); The window is at the front of all Windows win.show(); # window display win.showDevTools(); # Show devTools for debugging const shortcut = new nw.Shortcut({ key: 'Command+Alt+Tab'}); nw.App.registerGlobalHotKey(shortcut); ` ` `Copy the code
-
Ban debugging
Add the following line to # package.json "chromium-args":"--disable-devtools".Copy the code