44

I am starting up with node This is from node.js README.md

Prerequisites (Unix only):

* GCC 4.2 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
* libexecinfo (FreeBSD and OpenBSD only)

Curious to know why does node.js need Python ? Does it use Python underneath its API

1

2 Answers 2

41

Node.js is built with GYP — cross-platform built tool written in Python. Also some other build steps are implemented in Python. So Python is required for building node from source.

But you also need Python for building native addons.

Sign up to request clarification or add additional context in comments.

3 Comments

has there ever been a conversation on converting the node.js depending on python through gyp to something native (like node,js itself)?
@BrandonRos, here is one from 2015-2017, though I wish I knew of a more recent one: github.com/nodejs/NG/issues/24
3

Yes, node uses some python scripts under the hood, though Node is largely written in C++.

See some of Node's python code here:

https://github.com/joyent/node/tree/master/tools

E.g., js2c.py converts Javascript into C-style char arrays:

https://github.com/joyent/node/blob/master/tools/js2c.py

In general, if a package tells you that it requires Python, then it is almost certainly using Python ;)

2 Comments

It sure is using Python :) . But is Python used just during installation or during the run time of node scripts as well ? If the latter will it affect the performance in those cases
Python is not used at runtime.

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.