Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Last active March 1, 2017 09:05
Show Gist options
  • Save EddyVerbruggen/e57dac11e272cad5c3fccd0df6b9aa3b to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/e57dac11e272cad5c3fccd0df6b9aa3b to your computer and use it in GitHub Desktop.
Require node-uuid without nativescript-nodeify
// adding this line to your app...
var uuid = require('node-uuid');
console.log("uuid.v1: " + uuid.v1());
// ... leads to a crash (triggered by that first line) and this error being logged:
// error: file:///app/tns_modules/node-uuid/./uuid.js:121:24: JS ERROR TypeError: _rng is not a function. (In '_rng()', '_rng' is undefined)
// ... which is caused by these lines in uuid.js:
var _rb = require('crypto').randomBytes;
_rng = _rb && function() {return _rb(16);};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment