So I\'ve been working with Node.js on C9 recently and ran into this problem in a javascript file:
jsdom.env(\"\", function(err, window) {
TypeError: jsdom.en
Step 1: npm install jquery
Step 2: npm install jsdom
//add dummy function to test jquery in Node
function fn1( value ){ console.log( "fn1 says " + value );}
function fn2( value ) {console.log( "fn2 says " + value ); return false;}
var jsdom = require('jsdom');
const { JSDOM } = jsdom;
const { window } = new JSDOM();
const { document } = (new JSDOM('')).window;
//comment out the line below it create problem
//global.document = document;
var $ = jQuery = require('jquery')(window);
var callbacks = $.Callbacks();
callbacks.add(fn1);
callbacks.fire("foo!");
callbacks.add( fn2 );
callbacks.fire( "fool!" );