Performance Zone is brought to you in partnership with:

Neil Mackenzie is a Cloud Solution Architect for Microsoft. He has worked with computers for three decades. Neil started by doing large-scale numerical simulations for scientific research and business planning. Since then, he has primarily been involved in healthcare software, developing electronic medical record systems. He has been using Microsoft Azure since PDC 2008, and has used nearly all parts of the Azure platform — including those parts that no longer exist. Prior to joining Microsoft, Neil was a Microsoft MVP for Azure. Neil is a DZone MVB and is not an employee of DZone and has posted 17 posts at DZone. You can read more from them at their website. View Full User Profile

My Tale of NPM Woe: When All Else Fails, Fix Your Path!

  • submit to reddit

To end the year I decided to look at Node.js and, in particular, the restify module. Things went south pretty quickly when npm install failed for restify with the following error (fragment):

npm ERR! git clone git:// CreateProcessW: The
system cannot find the file specified.
npm ERR! git clone git://
The system cannot find the file specified.
npm ERR! Error: `git “clone” “git://”
failed with 127
npm ERR! at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\exec.js:56:20)

I reinstalled Node on the PC and tried again with no more success. I used another PC and again met failure. This surprised me because I had successfully installed restify a few weeks ago.

A web search quickly brought me to a Glenn Block (@gblock)  post with a similar seeming error when he installed restify (and apologies to Glenn for stealing his title). Glenn solved his problem by cleaning out the npm cache. I tried this using:

npm cache clean

and watched the cache vanish from %appdata%\npm-cache. Alas, unlike Glenn’s, my tale of npm woe continued since this didn’t solve the problem.

Another search led me to this post on the Windows Azure forums with the title npm fails on git dependencies in package.json. The latest version of restify has two git dependencies in its package.json – and they seem to be the source of the problem since tweaking the restify package,json for restify to handle git download for them allows git install to complete successfully for that package.

This is not really a satisfactory solution but a careful reading of the forum post leads to the solution. Amit Apple (@amitapl) Amit writes: the part that’s failing is to find git.exe since you’re using a git url to install the npm package.

It’s hard from the original error message to detect that git.exe is the problem – as, indeed, it is. Although git.cmd was in the path git.exe was not – causing the download to fail since npm looked for git.exe. Fixing the path fixed my npm problem – woohoo.

And so my tale of npm woe ended. Now onto the new year and new problems.

Published at DZone with permission of Neil Mackenzie, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)