lpappone
lpappone

Reputation: 2755

Having trouble packaging node webkit app

I wrote a small app in node webkit, and am having trouble packaging it. My eventual goal is to have a .exe that I can give to other people.

I can run it from the command line with "nodewebkit".

I've tried zipping the files and saving the result as app.nw, but when I try to run that I just get the default node webkit screen. I've read through the docs on rogerwang github, but haven't gotten anywhere because I can't get through that first step.

The app consists of a few files: index.html, main.js, styles.css. It depends on a few node modules as well as jquery. The package.json file is pasted below... any suggestions would be much appreciated.

{
  "name": "spl",
  "version": "0.0.0",
  "description": "",
  "keywords": [],
  "main": "index.html",
  "homepage": "https://github.com/lpappone/spl",
  "bugs": "https://github.com/lpappone/spl/issues",
  "window": {
    "title": "Splitter",
    "toolbar": false,
    "frame": true,
    "width": 800,
    "height": 500
  },
  "author": {
    "name": "Lauren Pappone",
    "email": "",
    "url": "https://github.com/lpappone"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/lpappone/spl.git"
  },
  "dependencies": {
    "fast-csv": "^0.5.3",
    "recursive-readdir": "^1.2.0"
  },
  "devDependencies": {},
  "engines": {
    "node": ">=0.8.0"
  }
}

The directory structure looks like this, and when I inspect the contents of the .nw, it is exactly the same:

Upvotes: 2

Views: 599

Answers (1)

OldGeeksGuide
OldGeeksGuide

Reputation: 2918

You seem to be doing this on a Mac, so I'll cover that. Windows and Linux are slightly more complicated because they don't have App Bundles the way Mac OSX does. Are you copying your app.nw to the right place? Are you sure you're including everything in app.nw?

Is this what you're doing?:

First you need to create app.nw, which is just a zip file of your entire project. If you go to your project dir (the one containing package.json) you can do this by typing

zip -r ../app.nw .

Now create a copy of node-webkit.app and copy app.nw into node-webkit.app/Contents/Resources/

cp app.nw node-webkit.app/Contents/Resources/

You should be able to run node-webkit.app now and it should run your app. (You might have some issues with security settings and such)

See https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps#mac-os-x for further details.

Upvotes: 3

Related Questions