moos / wordpos

Part-of-speech utilities for node.js based on the WordNet database.
477 stars 41 forks source link

Cannot find module 'lapack' when bundling with Browserify #9

Closed mklickman closed 8 years ago

mklickman commented 8 years ago

When including wordpos in my project and bundling via browserify, running the browserify command, I'm receiving this error:


Error: Cannot find module 'lapack' from '[PROJECT_ROOT]/node_modules/wordpos/node_modules/
natural/node_modules/sylvester/lib/node-sylvester'

and here's the browserify command I'm running from the command line:

browserify [PROJECT_ROOT]/js/main.js -o src/content/content.js`

My main.js file is probably as simple as you can get; all I have in there right now is literally this:


var WordPOS = require('wordpos');

I'm assuming that I'm setting my paths correctly, since the error message is resolving to one of the node_modules directories down the dependency chain. I'd be happy to provide more code samples if needed; I'm pretty new to the whole browserify/node-packages-in-the-browser thing, so it's entirely possible that I'm just missing a step.

moos commented 8 years ago

Well this is a new usage I didn't anticipate! lapack seems to be a native OS-dependent shared library, so it can't be browserified.

Also -- wordpos itself has large DB files that can't be browserified. It must be run in a node.js environment.

Hope that helps.

moos commented 8 years ago

To run in a browser, you'll probably want to rely on a service. http://developer.wordnik.com/docs.html seems to have a nice API.

mklickman commented 8 years ago

Thanks for clearing that up, and yes, that makes sense that I would be having that problem. Appreciate the recommendation for wordnik.com, too!