I've installed JQuery to local package
Installing it isn't enough. You need to load it into your program…
const $ = require('jquery');
… and then $("#modalAddRole")
isn't going to do anything until you load your HTML into it.
See the documentation:
For jQuery to work in Node, a window with a document is required.
Since no such window exists natively in Node, one can be mocked by
tools such as jsdom. This can be useful for testing purposes.
require("jsdom").env("", function(err, window) {
if (err) {
console.error(err);
return;
}
var $ = require("jquery")(window);
});
But this seems like a very complicated approach to getting a debugging environment running. Assuming the production environment for the code in the browser, it would make a lot more sense to debug it in the browser.
Browsers have excellent debugging tools built-in these days, and simulating all the things browsers do by default is likely to make debugging harder because the debug environment is signficantly different to the production environment.