Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External require of midi results in "process.versions is undefined" in bundle.js #704

Closed
granmoe opened this issue Mar 24, 2014 · 1 comment

Comments

@granmoe
Copy link

granmoe commented Mar 24, 2014

Hi. I am trying to browserify node-midi from justinlatimer. I installed the npm package in my directory, then ran browserify -r midi > bundle.js. I created a bare bones html file that includes the following:

<script src="bundle.js"></script>
<script>
      var midi = require('midi');
      var input = new midi.input();
      console.log(input.getPortName(0)); // simple test to see if browserified midi works
</script>

This results in: "TypeError: process.versions is undefined" at bundle.js 90:

var fs = require('fs')
  , path = require('path')
  , join = path.join
  , dirname = path.dirname
  , exists = fs.existsSync || path.existsSync
  , defaults = {
        arrow: process.env.NODE_BINDINGS_ARROW || ' → '
      , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled'
      , platform: process.platform
      , arch: process.arch
      , version: process.versions.node // RIGHT HERE
      , bindings: 'bindings.node'
      , try: [
          // node-gyp's linked version in the "build" dir
          [ 'module_root', 'build', 'bindings' ]
          // node-waf and gyp_addon (a.k.a node-gyp)
        , [ 'module_root', 'build', 'Debug', 'bindings' ]
        , [ 'module_root', 'build', 'Release', 'bindings' ]
          // Debug files, for development (legacy behavior, remove for node v0.9)
        , [ 'module_root', 'out', 'Debug', 'bindings' ]
        , [ 'module_root', 'Debug', 'bindings' ]
          // Release files, but manually compiled (legacy behavior, remove for node v0.9)
        , [ 'module_root', 'out', 'Release', 'bindings' ]
        , [ 'module_root', 'Release', 'bindings' ]
          // Legacy from node-waf, node <= 0.4.x
        , [ 'module_root', 'build', 'default', 'bindings' ]
          // Production "Release" buildtype binary (meh...)
        , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ]
        ]
    }

Any ideas?

Thank you

@ghost
Copy link

ghost commented Mar 28, 2014

The midi module interfaces directly with your system hardware so this can't possibly work natively in the browser.

@ghost ghost closed this as completed Mar 28, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant