Compile node source under Mac

Source: Internet
Author: User
Tags git clone

Read an article win7 64x below compile node, link address: Compiling Nodejs and its source code research

Below to learn how to compile node source under the Mac.

The process is quite simple.

1, download the source code.

> mkdir nodesrc && cd nodesrc  #创建nodesrc目录 and navigate to that directory
> Git clone https://github.com/nodejs/node.git #使用git clone command download node source

Of course, you can download the package directly and extract it to the NODESRC directory.

2, understand the node source directory.

After the download is complete, we see a node directory under the NODESRC directory, which expands the node directory with the following main structure:

Talk about the role of several directories:

    • Benchmark: Some Nodejs performance test code
    • Deps:nodejs-dependent toolkit, including V8, Http_parser, Opensslzlib, zlib, UV ...
    • Doc: Document-related
    • Lib: contains JavaScript source code
    • SRC: Contains C + + source code
    • Test: Testing the Code
    • Tools: A tool for compiling

want to study the source of the analysis, the main concern Lib and src two directory code , this article does not talk about source code analysis.

3, compile node.

#定位到node目录下> cd node  #下面开始编译, it took me more than 10 minutes  >./Configure  #   make
#想安装node的话接着继续输入make Install command, I have other versions of node on my machine, so I don't have a

After the successful compilation, see more out of an out directory, there are Deps, Release, tools three subdirectories, compiled node is in the Release directory inside.

Let's Test it:

#定位到编译好的node文件所在的目录> CD out/release/#查看版本>./node-vv8. 0.0-Pre
#随便写写 >1+12

Success!

Compile node source under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.