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://github.com/pvorb/node-clone.git CreateProcessW: The system cannot find the file specified. npm ERR! git clone git://github.com/davepacheco/node-verror.git CreateProcessW: The system cannot find the file specified. npm ERR! Error: `git “clone” “git://github.com/pvorb/node-clone.git” “C:\\Users\\Neil\\AppData\\Local\\Temp\\npm-704\\1357013683090-0.8436955371871591″` 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.