Question

https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps

EXCERPT from the above link: "As a rule of thumb npm install your package.json on each platform you target to ensure everything works as expected."

What should be the code in package.json to accomplish packaging of an npm module within a node-webkit App for windows?

Any help is appreciated!

Was it helpful?

Solution

Read the advice the other way around:

Your package.json keeps intact; simply you should launch npm install at the root of the folder for each platform you target to ensure the fetched modules targets the platform.

OTHER TIPS

if this is for windows platform, you can add node.exe copy to your package along with node_modules folder to achieve maximum compactability.

Alternative to above would be to specify the node engine version and the fixed version of dependencies of every module your project needs.

You can also write an install script using installer scripts like NSIS to create an executable which deploys your app ,also take a look at this documentation for package.json

https://www.npmjs.org/doc/json.html

ALTERNATIVE SOLUTION:

http://nodejs.org/docs/latest/api/modules.html#modules_loading_from_node_modules_folders

The above link describes how node.js looks for modules. After downloading the required npm just place it in the node_modules folder in the root directory of the app. node will automatically look in it if require('example'); is mentioned in the code, unless node is disabled in the package.json file.

After doing the above, one can follow the packaging procedures while keeping in mind that this solution is 'platform' and 'node-webkit version' specific.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top