Reputation: 4408
I'm trying to get my node.js Hello World code to work. My problem is that when I try to run my "Hello World" js script file on my node console, I get "..." and it keeps repeating this until I run .clear
command.
But when I type my hello code directly into console, everything works just fine... I'm using Windows 7 x64.
Here is a screenshot of the result:
https://i.sstatic.net/SJqaQ.png
Upvotes: 0
Views: 29544
Reputation: 1
Now you just go to [Start > All Programs > Node.js > Node.js command prompt] and then run from there.
Upvotes: -2
Reputation: 4643
from cmd.exe change directory to the script directory, then hit:
node hello.js
then from the web browser go to :
http://127.0.0.1:8000/
you'll see the hello world message :)
Upvotes: 2
Reputation: 20463
then run the following commands from the command line:
cd c:\Users\Shhinigami\Desktop\
node hello.js
When you run node.exe by itself, it opens up the node interface. When you run it with an argument, such as a filename, it tries to execute the file you pass as the argument. Also, run:
node -h
Upvotes: 2
Reputation: 14126
You are trying to run your program inside node itself. The console you are starting your program from, is for raw javascript code. The line you wrote there is meant to be run in the windows terminal. Try the same command there and it'll work.
Upvotes: 15