isaacs/npm — Issue #2230: npm breaks on Windows when running off a UNC path
Author: davidebbo
Created: 2012-03-06 05:40:07+00:00
State: open

REPRO STEPS:

- create some UNC share on a different machine, e.g. `\\myserver\myshare\npmtest`
- In there, create a package.json with the following contents.

{
"name": "app"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"mkdirp": "0.0.7"
}
}

- Open a PowerShell window, and cd to `\\myserver\myshare\npmtest`. We can't use cmd here because it doesn't support cd'ing to UNCs.
- In there, run the following command. Note that we can't use npm.cmd here because we're using a UNC. So we run node and use the npm js file explicitly:

`node "${env:ProgramFiles(x86)}\nodejs\node_modules\npm\bin\npm-cli.js" install`

RESULT:

It fails with the following error:

npm http GET https://registry.npmjs.org/mkdirp/0.0.7
npm http 304 https://registry.npmjs.org/mkdirp/0.0.7
npm ERR! error installing mkdirp@0.0.7
npm ERR! error rolling back mkdirp@0.0.7 Error: UNKNOWN, unknown error '\\SHARON-PC\data\tmp\node_modules\mkdirp'

npm ERR! Error: ENOENT, no such file or directory '\\SHARON-PC\data\tmp\node_modules\mkdirp\package.json'
npm ERR! You may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR!
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\\Dropbox\\util\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd \\SHARON-PC\data\tmp
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.1
npm ERR! path \\SHARON-PC\data\tmp\node_modules\mkdirp\package.json
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '\\SHARON-PC\data\tmp\node_modules\mkdirp\package.json'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! \\SHARON-PC\data\tmp\npm-debug.log
npm not ok

NOTE: the same works fine when not using UNC. Note that in our real scenario, we're launching this programmatically from an exe. The use of PS is just the isolated repro.