Issue 1:
so if you install it w apm install it simply doesn't work, throws errors. just add it to package.json and lauhch node CLI, then load chokidar

everything is cool w NPM.

node v0.10.35

npm 2.1.18

atom-shell v0.20.5

log:

[2048:0114/122537:INFO:renderer_main.cc(207)] Renderer process started
Assertion failed: (handle->InternalFieldCount() > 0), function Wrap, file /Users/user/.atom/.node-gyp/.node-gyp/0.20.0/src/node_object_wrap.h, line 77.
[1] 2046 abort ../atom-shell-v0.20.5-darwin-x64/Atom.app/Contents/MacOS/Atom .

Issue 2:
I am not sure if this is the right place to file this issue, but I am starting here because I dont see the issue when using vanilla npm.

Setup:

Atom Shell 0.19.4

APM --version

apm 0.111.0

npm 1.4.4

node 0.10.33

python 2.7.6

git 2.1.2

chokidar 0.11.1

To reproduce:

unzip atom shell 0.19.4

create a bare atom shell application as outlined at https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md

add a dependency to chokidar from the package.json

{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js",
"dependencies": {
"chokidar": "*"
}
}

use chokidar from main.js

var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.

var chokidar = require('chokidar');
var watcher = chokidar.watch("~/", { persistent: true, usePolling: false });
watcher.on("all", function(type, path) {
console.log(type, path);
});

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit();
});

// This method will be called when atom-shell has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600});

// and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');

// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});

install chokidar using apm: "apm install ."

run our app

As soon as you launch the app, you will find this on the command line:

➜ MacOS ./Atom ~/Desktop/watchapp

Assertion failed: (handle->InternalFieldCount() > 0), function Wrap, file /Users/bpasero/.atom/.node-gyp/.node-gyp/0.19.4/src/node_object_wrap.h, line 77.

[1] 4859 abort ./Atom ~/Desktop/watchapp

I am able to use chokidar with its native dependency (fsevents) on both node.js 0.10 and 0.11, but it fails when used from Atom.

Any pointers to how to further debug this issue is welcomed.

I uploaded my full Atom app to reproduce without following the steps to here: https://drive.google.com/file/d/0B3qppHphwBz0eEp0UmF0QnVUeVU/view?usp=sharing