Javascript should be the hot language right now, especially with Node.js as the go-to language, and even embedded. This article is not going to talk about the advantages of Node.js, which are all over the web, but the disadvantages of Node.js.

Disadvantage 1 Large NPM package

NPM is the library management software that came with Node.js, and the one-click download of third-party libraries immediately cataputed Node.js into the fast lane. NPM now has the most third-party libraries of any language, with at least 300,000 libraries, and more every day.

However, such A convenient tool also brings some troubles. First, it is very large. Because NPM does not flatten package dependencies, the same package will be installed repeatedly, for example, Module A needs Module C, module B also needs Module C. At this point, other languages should only download module C, but NPM will download module A and Module B respectively, so that our software volume will repeatedly increase. Fortunately, NPM later added A flattening method, but the trouble is that you need to do this manually, not automatically.

Secondly, the volume of third-party packages of NPM is also getting bigger and bigger. The commonly used packages like Lodash or Ramda will consume 10MB of memory once loaded, but we may only use 1% of its function. With the version upgrade of some packages, the volume is getting bigger and the memory is also consuming more and more. And developers are even more frustrated that we have no choice!

Finally, one of the drawbacks of NPM is that there are so many packages that you don’t know which ones are high quality and which ones are just there. Some libraries haven’t been maintained for years.

Disadvantages 2 Node.js eats memory

Node.js is a good example of Google’s memory – eating tradition! Have you noticed that Node.js has no dynamic library at all, the entire application has only one node.js😱, know what this means? Every time you start a Node.js process, you have to load it all. Now Node.js is 10MB, which means your program doesn’t do anything. There’s no 10MB of memory left. Other languages use dynamic libraries to solve this problem. The first process may consume more memory, but subsequent processes share the same dynamic library, thus reducing memory consumption. Node.js is designed for better memory isolation. However, the dynamic library technology has been very mature, and there have been no problems, feeling that Node.js is behind The Times in this point.

The worst thing I can think of are these two, and I don’t know if you’ve added any