Newbie Question

已查看 51 次
跳至第一个未读帖子

MANAV GARG

未读,
2015年8月28日 22:41:462015/8/28
收件人 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

未读,
2015年8月28日 23:57:382015/8/28
收件人 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

未读,
2015年8月28日 23:57:462015/8/28
收件人 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

未读,
2015年8月30日 00:59:192015/8/30
收件人 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

未读,
2015年9月8日 14:26:282015/9/8
收件人 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
回复全部
回复作者
转发
0 个新帖子