What if you remove the script content and keep just
function beforeRender(req, res) { }Does it also crash?
Don't you have some other scripts that are marked as global? Mabe it's crashing there.
It seems like something in your scripts is calling JSON.parse() on an invalid json.
where is the node_modules files in windows?
typically in your application folder
how can I delete and re-install packages?
you can delete the node_modules and call npm i inside the app folder. (Be sure to backup everything)
However, I would rather explore your scripts first.