0

I have a new project where I'm using browserify to convert node modules into an sdk that can run inside the browser.

I'm requiring a number of other npm packages like:

var log4js = require('log4js');

That run fine and give me no problems in the browser, however JsSip just will not cooperate. When I do

var JsSIP = require('jssip');

I get

plivowebsdk.js:2 Uncaught Error: Cannot find module '../../package.json'

Looking through the code, it's obvious when it makes this call

var pkg = require('../../package.json');

is where it bombs out. Clearly it cannot find the package.json file, which it uses to pull out version information. I know JsSip is actually built with browersify itself (or used to be) so that it can run in either node or a browser. Is this causing a conflict?

Still sort of new to browserify, is their a configuration option or transformation I can perform to get around this?

Michael Sivolobov
  • 12,388
  • 3
  • 43
  • 64
sauce
  • 592
  • 4
  • 9
  • 25
  • Given that `npm install jssip` fails, I'd suggest [raising an issue](https://github.com/versatica/JsSIP/issues) - if the version that was published yesterday won't install, that's a pretty major problem. – cartant Sep 10 '16 at 00:55

1 Answers1

0

Turned out the be browserify errors, re did the build process using the gulp recipes for browersify and works as expected.

sauce
  • 592
  • 4
  • 9
  • 25