b4dnewz/node-censys

Censys is not a constructor

Closed this issue · 3 comments

const instance =new Censys({
apiID : xxxxx,
apiSecert : xxxxx
});
Above code is showing following error:
uncaughtException: Censys is not a constructor\nTypeError: Censys is not a constructor\n

how do you import it?
can you show all the code that you are running and the version that you are using?

Hi @b4dnewz
var Censys = require('censys.io');

const instance =new Censys({
apiID : "3d6xxxxxxxxxxxxxxxxxxxx",
apiSecert : "kfOxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
});

I am working in nodejs!!

the problem is here var Censys = require('censys.io');

Since the module is typescript based you should use import statement as shown in the project readme or requiring the default export if using node require.

var Censys = require('censys.io').default;

Check this SO answer for some background informations about this