1

I just installed the recent installer of node.js v0.6.13 on my windows system. Now that I have done that what else do I need to do in order to make this work.

my nodejs resides in my Program Files(X86) folder and my js file is in c:\inetpub\www\root folder but then when I opened the node.exe and tried to run the js file in the wwwroot dir it did nothing. Then I copied the js file inside the nodejs folder and tried to run the js file in the console and I got the following error:

ReferenceError: helloWorld is not defined

at repl:1:2
at REPLServer.eval (repl.js:80:21)
at Interface.<anonymous> (repl.js:182:12)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream.<anonymous> (readline.js:82:12)
at ReadStream.emit (events.js:88:20)
at ReadStream._emitKey (tty.js:327:10)

I am new to this so don't know much about this, can someone revert back with instructions to make this work.

Thank you!

3
  • 2
    Can you show your source code that's not running? The fact that it's in inetpub leads me to believe you also don't understand just what Node.js is, yet. (It handles its own web serving needs with an internal HTTP server object, so IIS wouldn't be used.) Commented Mar 22, 2012 at 18:36
  • Yes like I said I am new to this, but how does it matter where my project file resides on my system. How can I execute Node.exe to execute my helloWorls.js file. Commented Mar 23, 2012 at 12:38
  • 1
    No, it doesn't really matter, but Node.js modifies the global scope of Javascript to be different from Javascript in the browser, so without being very careful, the .js files written for Node.js won't work in the browser (and therefore you wouldn't want them showing up on IIS). Commented Mar 23, 2012 at 15:55

1 Answer 1

2

Based on that error, it looks like you are trying to start your JS file from the REPL like

node.exe
> hellowWorld

If your code is in helloWorld.js, you should run it like this:

node.exe helloWorld.js
Sign up to request clarification or add additional context in comments.

3 Comments

This works! Do you have a link which shows how to setup and configure nodejs without installing npm and other modules.. I thought the installer should work just fine...and I can create my files and open command prompt and run the js files. Is that how it's suppose to work or do I need to do anything else?
The installer already installed npm for you, by the way. But you're right about the second part. You can just write directly to the Node.js API and have a working web server for whatever it is you're trying to do.
@Vish Yep, as David said, you just get the executable, what you do from there is up to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.