Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-49

Error loading native bson library : %1 is not a valid Win32 application.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      Windows 7, 64 bit
      v 1.3.11 of the node driver

      When configuring to use the native bson parser on windows, we get an error.

      Adding in some missing logging, we see the following error:

      %1 is not a valid Win32 application.
      E:\dev\projects\trunk\server\node_modules\mongodb\node_modules\bson\ext\win32\x64\bson.node
          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.<anonymous> (E:\dev\projects\trunk\server\node_modules\mongodb\node_modules\bson\ext\index.js:5:10)
          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)
      

      I monkey-patched the bson/ext/index.js to replace

      // Load the precompiled win32 binary
      if(process.platform == "win32" && process.arch == "x64") {
          console.log("yes?");
        bson = require('./win32/x64/bson');
      } else if(process.platform == "win32" && process.arch == "ia32") {
        bson = require('./win32/ia32/bson');
      } else {
        bson = require('../build/Release/bson');
      }
      
      

      with

      bson = require('bindings')('bson');
      

      With my own compiled native component, and all works sweetly.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            nick.minutello@credit-suisse.com Nick Minutello
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: