My advice is to begin w/ a minimum runnable “index.html” template file like this 1:
<script defer src=https://Unpkg.com/p5></script>
<script defer src=sketch.js></script>
Once verified it’s working, you can add more stuff to it little by little.
Here’s some online sketch using this very same minimum template: