Package development, pty.js: incompatible native module


#1

I am trying to write a simple terminal package for atom that can be considered a decent example for 1.0 ā€“ e.g. no hardcoded keybinds, no spacepen views, and interoperability through the services API.

Iā€™d also like it to install out-of-box without user intervention :wink: ā€“ and am now struggling to figure out how to trigger apm rebuild of the package to satiate the pty.js requirement. The following error is shown on a fresh installation:

"Failed to require the main module of 'termy' because it requires an incompatible native module. Run "apm rebuild" in the package directory to resolve."

The bug dialog reports pty.js as the offender:

Rebuilding seems to fix.

Is there a way around this error outside user intervention in the bugs dialog or console?

below is the package.json (https://github.com/briceburg/atom-termy/blob/master/package.json)

{
  "name": "termy",
  "main": "./lib/termy",
  "version": "0.1.1",
  "description": "spawn a terminal with a relativized cwd below or to the right of the active file",
  "keywords": [
    "terminal",
    "term",
    "shell",
    "tty",
    "pty"
  ],
  "repository": "https://github.com/briceburg/atom-termy",
  "license": "MIT",
  "engines": {
    "atom": ">=1.0.0 <2.0.0"
  },```
  "dependencies": {
    "pty.js": "^0.3.0",
    "term.js": "^0.0.7"
  }
}

many thanks!

~ Brice