r/programminghelp • • Nov 12 '22

JavaScript How to run a JS program?

Hey so I've been trying to run a js file in local host but it refuses to connect. I also tried nodejs and it doesn't recognize my file. What else could I do.?

1 Upvotes

5 comments sorted by

2

u/DeVoto Nov 12 '22

1

u/[deleted] Nov 12 '22

nope, here's the error: Uncaught SyntaxError: Unexpected identifier 'app' (or any other file i put in)

4

u/DeVoto Nov 12 '22

Can you run a file that just has the following in it:

console.log("Hello, World!");

Seems to me like you're trying to run a Javascript file which is expecting `app` to be defined else where. Hence why you get a syntax error.

3

u/[deleted] Nov 13 '22

Post the code you're attempting to run.