npm install fails with git remote helper error for https URLs

I’m getting a strange error when trying to run npm install on my React Native project. This happens during an automated build process and I can’t figure out what’s wrong.

The error message looks like this:

npm ERR! git fetch -a origin fatal: Unable to find remote helper for 'https'
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/5.4.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.4.0
npm ERR! npm v3.3.12
npm ERR! code 128
npm ERR! Command failed: git fetch -a origin
npm ERR! fatal: Unable to find remote helper for 'https'

It seems like npm is trying to fetch some dependency from a git repository but can’t handle the https protocol. I’ve tried looking for solutions but nothing seems to work for my specific case. Has anyone encountered this issue before? What could be causing npm to not recognize https URLs when fetching git dependencies?

This happens when Git’s missing the curl libraries for HTTPS support. I hit this on an older macOS build server where Git was compiled without proper HTTPS support. Usually, it’s because you’re using a Git installation that doesn’t have the right transport protocols. Check with git --version to see if your Git supports HTTPS. If you’re using Homebrew, try brew reinstall git to make sure it includes all transport protocols. You might also have multiple Git installations fighting each other - run which git and git --exec-path to check. Another fix is setting the Git binary path for npm with npm config set git /usr/local/bin/git if you’ve got a working Git install somewhere else.

Had this exact problem last month during CI/CD setup. My system had git configured for ssh but package.json dependencies were pointing to https URLs. Check if git’s installed properly with SSL support first. Run git ls-remote https://github.com/git/git.git - if it fails with the same error, git can’t handle https. On macOS, I had to reinstall command line tools with xcode-select --install because Xcode’s git was missing curl support. After that, npm install worked perfectly. Your build environment’s probably using a stripped-down git that doesn’t include https transport.

i had that too! turning off https for git worked for me. run git config --global url."git://".insteadOf "https://" to set it. gives npm a boost then, lol. hope it helps!