title: Cannot find module /build/Debug/iconv.node
body: <p>I'm trying to run a node.js server on an Ubuntu VM.  </p>
  
  <p>I keep getting this error:</p>
  
  <pre><code>Error: Cannot find module '../build/Debug/iconv.node'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.&lt;anonymous&gt; (/vagrant/api/node_modules/geoipcity/node_modules/iconv/lib/iconv.js:27:14)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.&lt;anonymous&gt; (/vagrant/api/node_modules/geoipcity/geoipcity.js:35:13)
  </code></pre>
  
  <p>The code around this line:</p>
  
  <pre><code>/vagrant/api/node_modules/geoipcity/node_modules/iconv/lib/iconv.js:27:14
  </code></pre>
  
  <p>Looks like this:</p>
  
  <pre><code>var bindings;
  try {
    bindings = require('../build/Release/iconv.node');
  }
  catch (e) {
    bindings = require('../build/Debug/iconv.node');
  }
  </code></pre>
  
  <p>The weird thing is that this file exists when I poke around my directory structure:</p>
  
  <pre><code>/vagrant/api/node_modules/geoipcity/node_modules/iconv/build/Release/iconv.node 
  </code></pre>
  
  <p>So I'm not sure why that try catch block is ever getting to catch.  Actually, as I wrote that last sentence I decided to try to log the error that is caught.  It was:</p>
  
  <pre><code>[Error: /vagrant/api/node_modules/geoipcity/node_modules/iconv/build/Release/iconv.node: invalid ELF header]
  </code></pre>
  
  <p>Not sure if this is relevant, but I tried running: </p>
  
  <pre><code>node-gyp rebuild
  </code></pre>
  
  <p>With this result</p>
  
  <p><code>
  gyp info it worked if it ends with ok
  gyp info using node-gyp@0.13.0
  gyp info using node@0.10.26 | linux | ia32
  gyp info spawn python
  gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
  gyp info spawn args   'binding.gyp',
  gyp info spawn args   '-f',
  gyp info spawn args   'make',
  gyp info spawn args   '-I',
  gyp info spawn args   '/vagrant/api/build/config.gypi',
  gyp info spawn args   '-I',
  gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
  gyp info spawn args   '-I',
  gyp info spawn args   '/home/vagrant/.node-gyp/0.10.26/common.gypi',
  gyp info spawn args   '-Dlibrary=shared_library',
  gyp info spawn args   '-Dvisibility=default',
  gyp info spawn args   '-Dnode_root_dir=/home/vagrant/.node-gyp/0.10.26',
  gyp info spawn args   '-Dmodule_root_dir=/vagrant/api',
  gyp info spawn args   '--depth=.',
  gyp info spawn args   '--no-parallel',
  gyp info spawn args   '--generator-output',
  gyp info spawn args   'build',
  gyp info spawn args   '-Goutput_dir=.' ]
  gyp: binding.gyp not found (cwd: /vagrant/api) while trying to load binding.gyp
  gyp ERR! configure error 
  gyp ERR! stack Error: <code>gyp</code> failed with exit code: 1
  gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:340:16)
  gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
  gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
  gyp ERR! System Linux 3.2.0-23-generic-pae
  gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild"
  gyp ERR! cwd /vagrant/api
  gyp ERR! node -v v0.10.26
  gyp ERR! node-gyp -v v0.13.0
  gyp ERR! not ok 
  </code></p>
  
  <p>Ok, that's about all I have for now.  Will keep searching for a solution and update here if I find anything new.</p>
  
  <p>Thanks in advance for the help.  Oh, and please be gentle - I'm a Linux noob.</p>