What are 'tools for native modules'? Help a newbie decide if they are necessary (NodeJS installation)
Asked Answered
P

2

10

I have just started my NodeJS course, the lecture was recorded at the time of NodeJS version 10 (on a mac). I'm on Windows, it is now version 16. The lecture does not contain this page of the installation screen:

Installation wizard screenshot

Summary: I do not know if I want native modules, or what they are - but I do not want chocolatey.

I have done my research, yet still I cannot find anything to clear up the following question for me anywhere.

1.My question:
How important are these native modules? Do I need them? Or do you recommend them, and why?

2.Chocolatey:
Out of interest, perhaps you could tell me why NodeJS have bundled together native modules and Chocolatey?

I have decided I do not want chocolatey (no problem, if I decide to install the 'tools' then I will go onto GitHub and install them manually, as it says in the screenshot.)

The reason I do not want chocolatey is because: from my research I do not think I need chocolatey and I have seen that uninstalling chocolatey will potentially cause me one or two problems, so I'll avoid it all together - but I thought I'd mention that here on the side, because maybe somebody knows a very valid reason why they are bundled together, and it will change my mind.

A big thank you to the Stack Overflow community.

Pence answered 26/2, 2022 at 8:8 Comment(0)
H
6

Native modules need to be compiled, most often (but not exclusively) from C/C++ source, in order to function. Some folks avoid them like cancer, as they need to be compiled on installation which can be a deployment risk. Others (like me) embrace native modules because of the performance benefits they can bring.

Note that this is not a concept unique to Javascript or Node.js. Other languages like Ruby and Python also have "modules" (by other names) that involve compiling native code in order to function as well.

As to why Node.js uses Chocolatey to manage its native toolchain, it's because Chocolatey already has packages available for the tools it needs. It doesn't make sense to maintain separate NPM packages of these tools, and relying on existing packages reduces a lot of overhead in getting a wide berth of tools and utilities installed. In addition, Chocolatey can be installed system wide or for only a specific application's use. I'm not sure which technique Node.js uses but if it's asking, I assume it wants to use a system-wide config.

If you don't want to use Chocolatey, you'll have to manage the native toolchain on your own. If you tell it to use Chocolatey, you can manage the toolchain upgrades with the choco upgrade command.


That said, I would consider exploring Chocolatey if I were you. It makes package management so much easier on Windows. It's about as close to a standard as a 3rd party solution can get, in part because it builds off of nuget, and you can technically manage Chocolatey packages with PowerShell without installing Chocolatey (though I don't recommend this, just use Chocolatey).

Heymann answered 8/4, 2022 at 16:1 Comment(0)
P
4

Native modules are are optional. The issue suggests they are large and hard to remove if you add them.

Somebody had raised this question to the node.js developers through a github issue.

tl;dr It is not essential for node.js

Phenobarbital answered 20/10, 2022 at 7:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.