So everything was working just fine and great until doing npm update and now things do not work quite as they used to.
A little background: in my code I use jquery
I solved it. had to first remove jsdom and jquery then npm install jsdom jquery.
Then this:
var jsdom = require("jsdom"); $ = require("jquery")(jsdom.jsdom().createWindow());
Turns out that it was important that I had the latest version. Otherwise it didn't work..