ejs showing error inside a script tag

<script>
    window.data = <%- JSON.stringify(data) -%> 
</script>
<%- include('header') -%>   
    <div id="root"><%- content -%></div>
<%- include('footer') -%>

This throws an error saying unexpected end of input in the script tag. This is running on the server side and both data and content is provided by the render call.


This means that the function call JSON.stringify ran into an error. Could you log out the data and verify that it is indeed valid JSON?

Some common faults are missing brackets like } or ], or keys/values in the JSON that are not wrapped with double quotes (").