I am really new to nodejs, and i am putting myself through a crash course these 3-4 days to get a bit better at it... Trying to run this code:
(function () {
var jsdom = require('jsdom');
jsdom.env({
html: '<html><body><h1>Hello World!</h1><p class="hello">Heya Big World!</body></html>'
//scripts: [
//'http://code.jquery.com/jquery-1.5.min.js'
//]
}, function (err, window) {
//var $ = window.jQuery;
var $ = require('jquery')(window)
$('body').append("<div class='testing'>Hello World</div>");
console.log($(".hello").text()); // outputs Hello World
});
}());
I get this error:
/root/node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js:2
const xnv = require("xml-name-validator");
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/root/node_modules/jsdom/lib/jsdom/level1/core.js:8:20)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10
And i am clueless to solve it. Sorry for the nooby question...