<p dir="auto">so if you install it w apm install it simply doesn't work, throws errors. just add it to package.json and lauhch <code class="notranslate">node</code> CLI, then load chokidar</p>
<p dir="auto">everything is cool w NPM.</p>
<p dir="auto">node v0.10.35<br>
npm 2.1.18<br>
atom-shell v0.20.5</p>
<p dir="auto">log:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2048:0114/122537:INFO:renderer_main.cc(207)] Renderer process started
Assertion failed: (handle-&gt;InternalFieldCount() &gt; 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 ."><pre class="notranslate"><code class="notranslate">[2048:0114/122537:INFO:renderer_main.cc(207)] Renderer process started
Assertion failed: (handle-&gt;InternalFieldCount() &gt; 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 .
</code></pre></div>
<p dir="auto">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.</p>
<p dir="auto">Setup:</p>
<ul dir="auto">
<li>Atom Shell 0.19.4</li>
<li>APM --version
<blockquote>
<p dir="auto">apm  0.111.0<br>
npm  1.4.4<br>
node 0.10.33<br>
python 2.7.6<br>
git 2.1.2</p>
</blockquote>
</li>
<li>chokidar 0.11.1</li>
</ul>
<p dir="auto">To reproduce:</p>
<ul dir="auto">
<li>unzip atom shell 0.19.4</li>
<li>create a bare atom shell application as outlined at <a href="https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md">https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md</a></li>
<li>add a dependency to chokidar from the package.json</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;    : &quot;your-app&quot;,
  &quot;version&quot; : &quot;0.1.0&quot;,
  &quot;main&quot;    : &quot;main.js&quot;,
  &quot;dependencies&quot;: {
    &quot;chokidar&quot;: &quot;*&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "name"    : "your-app",
  "version" : "0.1.0",
  "main"    : "main.js",
  "dependencies": {
    "chokidar": "*"
  }
}
</code></pre></div>
<ul dir="auto">
<li>use chokidar from main.js</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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(&quot;~/&quot;, { persistent: true, usePolling: false });
watcher.on(&quot;all&quot;, 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;
  });
});"><pre class="notranslate"><code class="notranslate">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;
  });
});
</code></pre></div>
<ul dir="auto">
<li>install chokidar using apm: "apm install ."</li>
<li>run our app</li>
</ul>
<p dir="auto">As soon as you launch the app, you will find this on the command line:</p>
<p dir="auto">➜  MacOS  ./Atom ~/Desktop/watchapp<br>
Assertion failed: (handle-&gt;InternalFieldCount() &gt; 0), function Wrap, file /Users/bpasero/.atom/.node-gyp/.node-gyp/0.19.4/src/node_object_wrap.h, line 77.<br>
[1]    4859 abort      ./Atom ~/Desktop/watchapp</p>
<p dir="auto">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.</p>
<p dir="auto">Any pointers to how to further debug this issue is welcomed.</p>
<p dir="auto">I uploaded my full Atom app to reproduce without following the steps to here: <a href="https://drive.google.com/file/d/0B3qppHphwBz0eEp0UmF0QnVUeVU/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B3qppHphwBz0eEp0UmF0QnVUeVU/view?usp=sharing</a></p>