Skip to main content

Npm in need of current Git version

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer
Head of IT Business Operations

Recently we were in the need to create (and host) an own npm module. Setting up a private repository with sinopia seemed like a bit too much work for hosting just a single npm package. So I decided to use the built-in functionality of npm to directly refer to a git repository in the package.json file. This worked fine on "my machine" but failed on my co-workers machine. It turned out that we were both using the same version of nodejs and npm but we were running different versions of git. I had a recent version of git running. My co-worker's git version was pretty old (1.7.x). I advised that we should upgrade git any try again. And guess what, after the upgrade npm install worked perfectly fine.

Since we are using Ubuntu upgrading git was as easy as this:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Be aware that these commands will install git in version 2.x. Read here what's different in the latest version of git.