One Size Fits All

Using NPM for more than JavaScript

Node Package Manager, or NPM, is the de facto package manager for all Node.js projects. It’s installed whenever you install Node.js, so it’s kind-of shoved into your face from the start. Because of this tie between Node and NPM, people often think that NPM is like other package managers where it can be only used for its default language. But, NPM can be used for more than just JavaScript.

When you read that, you probably thought, “What? Why would you use a JS package manager for another language”? Well, NPM is a very intuitive, sophisticated package manager that is largely un-opinionated, which means that there are no true assumptions that packages on NPM are built in JavaScript. It’s a great tool, so the real question is…

NPM easily has the best project file out of any other package manager. Its package.json combines exceptional readability with great dependency management and project detailing. I promise I’m not fanboying; NPM is that much better than other project files.

A skeleton package.json

Take a look at that. The JSON file format makes it easy for us to find out the name, version, dependencies, and build scripts for the project, while still making it readable by the machine. That’s because JSON was designed to be easily read by humans while still being easy to parse by machines(what a beautiful compromise). And, let’s not forget that it’s lightyears ahead of project files for other languages like Java, Python, or C/C++.

Maven’s complicated pom.xml

Apache’s Maven project management tool for Java relies on a complex, impossible-to-read pom.xml. This is extremely difficult for humans to read and slows down development for projects with a lot of contributors.

Pip’s requirements.txt only contains dependencies

The Python Packaging Authority‘s pip uses a requirements.txt, but it’s so primitive that it’s only used to list required dependencies. At times simplicity is the best approach, but the requirements.txt becomes useless, since it doesn’t contain other project-specific information such as the official name or necessary build scripts.

GNU’s complicated Makefile looks like a source file

Don’t even get me started on the GNU’s Makefile. It doesn’t even look like a project management file. It looks like just another source file (although variables are an interesting feature). It’s basically just a file for build scripts, and it’s missing the project’s name and dependencies. Package.json proves to be the ultimate project management file.

Another thing that makes NPM unique is its package registry system. All packages built with NPM can be quickly deployed to a shared registry system from which anybody can install them. This package registry system, found at, makes all packages searchable, so you can quickly locate packages that perform any action you wish before installing them for your own project. NPM’s package registry is also pretty social, as you can search for other users and keep an eye on new releases from your favorite developers and organizations. Plus, the command line interface lets you build and publish a new package in seconds…as long as you have an account, of course.

Even wombats can make NPM packages!

Now, if you don’t believe that you can host non-Javascript projects on NPM, check out my example project on Github where I created and published a Python “Hello World” project.

I’ll go more in depth about creating non-Javascript packages in another post, but know now that, though unusual at first, using NPM as a package manager for other languages is a pretty good idea.

Thanks for reading! If you liked this post, please recommend or share.

You’re awesome!

More by Gerald Nash ⚡️

Topics of interest

More Related Stories