Newbie Question

51 views
Skip to first unread message

MANAV GARG

unread,
Aug 28, 2015, 10:41:46 PM8/28/15
to nodejs
If I type
node program.js
in my terminal. Where will the file be generated in the computer?

I am using Ubuntu 15

hacksparrow

unread,
Aug 28, 2015, 11:57:38 PM8/28/15
to nodejs
It will not generate any file.

You will have to create the program.js file yourself and add some code in it. Let' say you have added the following:

console.log('Hello World!');

Now, when you run node program.js from the terminal, this file will be executed by node and it will print "Hello World!" at the terminal.

Ryan Schmidt

unread,
Aug 28, 2015, 11:57:46 PM8/28/15
to nod...@googlegroups.com

On Aug 21, 2015, at 4:21 PM, MANAV GARG wrote:

> If I type
> node program.js
> in my terminal. Where will the file be generated in the computer?

If you type "node program.js", node will run the JavaScript program contained in the file "program.js" in the current directory. If the program in program.js writes a file specifying a filename but not a directory name, it will be created in the current directory.

boby rahmawan

unread,
Aug 30, 2015, 12:59:19 AM8/30/15
to nod...@googlegroups.com

Hi Manav, It's depend on your code in program.js . If output of code create a file it'll be, if not it can't. CMIIW

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/ed4f3d31-1691-4951-ad57-7b55f18b7c8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anirban Bhattacharya

unread,
Sep 8, 2015, 2:26:28 PM9/8/15
to nodejs
Hello Manav,

The command "node" will just execute the code written in the file  " program.js" . What do you have all in "program.js?

Best bet you will see the terminal in executing mode that means no cursor until you stop the previous command with CTRL+C
Reply all
Reply to author
Forward
0 new messages