Skip to content

Building against NW.js headers #1461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ To recompile `serialport` (or any native Node.js module) for Electron, you can u

For an example project, check out [`electron-serialport`](https://github.com/johnny-five-io/electron-serialport).

#### NW.js

[NW.js](https://nwjs.io/) is an app runtime based on Chromium and node.js.

Like Electron, NW.js also requires compilation against its own specific headers.

To instruct `prebuild` to build against the correct headers, place a file named `.prebuildrc` on your package root with the following content:

```
build_from_source=true
runtime=node-webkit
target=<target_version>
```

Where `<target_version>` is the NW.js version you are building against (for example, `0.26.6`).

OBS: NW.js support requires `prebuild >= 7.3.0`.

#### Illegal Instruction

The pre-compiled binaries assume a fully capable chip. Intel's [Galileo 2](https://software.intel.com/en-us/iot/hardware/galileo), for example, lacks a few instruction sets from the `ia32` architecture. A few other platforms have similar issues. If you get `Illegal Instruction` when trying to run Node-Serialport, you'll need to ask npm to rebuild the Serialport binary.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"istanbul": "^0.4.4",
"jsdoc": "^3.5.5",
"mocha": "^4.0.0",
"prebuild": "^7.0.0",
"prebuild": "^7.4.0",
"proxyquire": "^1.7.10",
"sinon": "^4.1.5"
},
Expand Down