title: Using Realm from npm on Electron JS app
body: <p>I am trying to use Realm imported with NPM but it fails.</p>
  
  <p>I am using the Realm example for JavaScript:</p>
  
  <pre class="lang-js prettyprint-override"><code>const Realm = require('realm');
  
  // Define your models and their properties
  const CarSchema = {
    name: 'Car',
    properties: {
      make:  'string',
      model: 'string',
      miles: {type: 'int', default: 0},
    }
  };
  const PersonSchema = {
    name: 'Person',
    properties: {
      name:     'string',
      birthday: 'date',
      cars:     'Car[]',
      picture:  'data?' // optional property
    }
  };
  
  Realm.open({schema: [CarSchema, PersonSchema]})
    .then(realm =&gt; {
      // Create Realm objects and write to local storage
      realm.write(() =&gt; {
        const myCar = realm.create('Car', {
          make: 'Honda',
          model: 'Civic',
          miles: 1000,
        });
        myCar.miles += 20; // Update a property value
      });
  
      // Query Realm for all cars with a high mileage
      const cars = realm.objects('Car').filtered('miles &gt; 1000');
  
      // Will return a Results object with our 1 car
      cars.length // =&gt; 1
  
      // Add another car
      realm.write(() =&gt; {
        const myCar = realm.create('Car', {
          make: 'Ford',
          model: 'Focus',
          miles: 2000,
        });
      });
  
      // Query results are updated in realtime
      cars.length // =&gt; 2
    })
    .catch(error =&gt; {
      console.log(error);
    });
  </code></pre>
  
  <p>And this is the error it throws:</p>
  
  <blockquote>
    <p>Uncaught Error: Cannot find module
    '[path]/node_modules/realm/compiled/electron-v2.0_darwin_x64/realm.node'
        at Module._resolveFilename (module.js:543:15)
        at Function.Module._resolveFilename ([path]/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
        at Function.Module._load (module.js:473:25)
        at Module.require (module.js:586:17)
        at require (internal/module.js:11:18)
        at Object. ([path]/node_modules/realm/lib/index.js:102:28)
        at Object. ([path]/node_modules/realm/lib/index.js:133:3)
        at Module._compile (module.js:642:30)
        at Object.Module._extensions..js (module.js:653:10)
        at Module.load (module.js:561:32)</p>
  </blockquote>
  
  <p>Thank you so much for help.</p>