[Node.js] II. How to install node.js, what should I write in the first program?

II. How to install node.js, what should I write?

How to install node.js?

Q: Hey, I said, can we follow the next question, you give me a code, but I should let this guy runs up, at least I want to see some effects.

A: Yes, no mistakes, you have seen some code, maybe you still don’t understand what this is calculated.

Q: Nothing wrong, at least how to download and install it, the rest is in my wisdom, no words.

A: Amount, ok, I don’t participate in comments.

You can choose to go to the official http://nodejs.org/ Select a version for download, of course you want to download a stable version, or you can use the address here, http: // nodejs

    Download by using Linux’s WGET command, like this
  1. sudo wget http://nodejs.org/dist/v0.10.15/node-v0.10.15.tar.gz
  2. After downloading, decompress, just like This
  3. Sudo TAR ZXVF node-v0.10.15.tar.gz

  4. Enter the Node compression directory, use such a command

  5. Sudo ./configure –prefix = Directory you want to install
  6. Sudo make

  7. Sudo make install
  8. 7. Ok, Here you have already installed here, now you will find a bin purpose under your installation directory.Record, then enter you will find a node and npm file, then this is right.

  9. What is the first program?

Q: Ok, I have seen these two files, what is the two files do?

A: Node file is the compiler of the Node.js script, and npm is used as the resource package used by the installation Node

Q: Know, then start now. , Told me how to write the first paragraph of meaningful code!

A: Well, good, now, we will use an editor, such as Vim, or editor you are familiar with, refer to my look, save it as hellonode.js

VAR Result = 0; for (var i = 1; i

Q: Ok, I have already referred to the code above, then What to do?

A: So this to do it, than my Node installation directory is / opt / node, then I need to implement this,

Sudo / Opt / Node / Bin / Node Hellonode.js
 You can use my method to do, see what the results are.  <=10;i++) {
    result += i;
process.stdout.write("Hello Node.js, 我已经使用你帮我算除了1到10的和等于"+result+", 真是厉害。"); 
Q: Good .

(operations …)

Q: well, have to get, I look at the results of it

  Hello Node! .js, I have used you to help me calculate the 1 to 10 and equal to 55, it is really powerful.  

A: Don’t I am so happy.

Q: Well? Why?

A: This is just a little fur in the fur, and you didn’t find this way of implementation?

Q: Yes, it is a bit of trouble, so how?Can you easily implement it?

A: This is …, good, time is not early, rest, come back tomorrow, I can’t eat hot tofu.
 Q: (Khan ...)                      
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment