The randombytes package doesn't work in the {N} runtime, so replace it by this package if you need to.
tns plugin add nativescript-randombytes
var randomBytes = require('nativescript-randombytes');
// sync usage
console.log("randomBytes: " + randomBytes(16));
// async usage
randomBytes(16, function (ignore, result) {
console.log("randomBytes async: " + result);
})