I'm having some trouble finding this specific information about NodeJS, I googled but I can't really find any answers to it. Hopefully you can clear some of my problems.
So, I installed NodeJS by following this guide in Ubuntu. I then used npm to install Sass by following this guide. I was able to get sass working just fine.
But here's where the confusion starts. I'm not entirely sure how to actually use Node. Am I supposed to always start a server by using this?
node myjsfile.js
If I don't do that and in my HTML file I add a script tag like so
<script src="js/myjsfile.js"></script>
Then when I load the page the console will output an error like
Uncaught ReferenceError: require is not defined
But, if I do run
node myjsfile.js
after setting up my files by following this guide, then none of the changes I do to the JS or HTML actually appear on my page, meaning that I have to constantly rerun the node
command to see any updates.
I'm sure I'm missing something here but I can't figure out what. I'd really appreciate some help.