I had this problem where a browser console would give errors like this
Your page is loading multiple Elm scripts with a module named Elm.Main.
At that point I had <script> tag near the bottom of the page.
Moving the source of my script to the <head> tag has solved part of the problem.
<head> ... <script src='/chart.js' type='text/javascript'></script> </head>
Another par of the solution was invoking the elm code somewhat differently than recommended in elm guides.
<script>
var node = document.getElementById('elm');
if (node) {
var app = Elm.Main.init({ node: node,
flags: <%= JSON.pretty_generate my_flag_data %>
}
);
}
</script>