Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does node.js need python

Tags:

python

node.js

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

like image 238
binithb Avatar asked May 17 '14 09:05

binithb


People also ask

Is node JS related to Python?

Comparing NodeJS vs Python, Node. js is an open-source JS framework used to build both client and server-side network apps, while Python is an object-oriented, high-level programming language. NodeJS has a reputation for creating scalable and high-performance apps with its rich tech stack and robust ecosystem.

Do you need Python to run NPM?

NPM has a package called windows-build-tools that should automatically install everything you need to get node-gyp working, including the Microsoft build tools, compilers, Python, and everything else required to build native Node modules on Windows.

CAN node JS replace Python?

No, because Node. js works with JavaScript, and Python has CPython.

What version of Python does node need?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.


2 Answers

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.

like image 55
vkurchatkin Avatar answered Oct 09 '22 06:10

vkurchatkin


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 ;)

like image 27
Icarus Avatar answered Oct 09 '22 05:10

Icarus