-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
A network-share/UNC path with a space in the name throws Error: UNKNOWN: unknown error, lstat [...] when trying to run a node script node "\\ERIC-MACBOOK\Macintosh HD\foo.js".
I ran into this situation after setting up file sharing on OSX and trying to run commands on the Macintosh HD share.
Using a network share that doesn't have a space in the name works just fine; Tested with share that points to user directory on the OSX machine and a separate NAS. It doesn't seem to matter if there are spaces in the rest of the path, just the share name.
Summary
node "\\ERIC-MACBOOK\Macintosh HD\foo.js": ThrowsError: UNKNOWN: unknown error, lstat [...]node "\\ERIC-MACBOOK\eric\foo.js": Works normallynode "\\some-nas\mlm\foo.js": Works normally
Terminal/CLI output
Running on Windows 10.
>node -v
v5.5.0
// foo.js
console.log('foo');On Windows, the pushd command will map a UNC path to a temporary drive letter. Just wanted to see if it made a difference because it eliminates the space in the path used. But is probably just a pointer to the UNC path with space anyway and why it causes similar errors.
\\ERIC-MACBOOK\Macintosh HD\
C:\Users\MLM\some-folder>node "\\ERIC-MACBOOK\Macintosh HD\Users\eric\Documents\some-project\foo.js"
fs.js:887
return binding.lstat(pathModule._makeLong(path));
^
Error: UNKNOWN: unknown error, lstat '\\ERIC-MACBOOK\Macintosh HD\'
at Error (native)
at Object.fs.lstatSync (fs.js:887:18)
at start (fs.js:1495:10)
at Object.realpathSync (fs.js:1483:3)
at toRealPath (module.js:126:13)
at Function.Module._findPath (module.js:165:20)
at Function.Module._resolveFilename (module.js:337:25)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
C:\Users\MLM\some-folder>pushd "\\ERIC-MACBOOK\Macintosh HD\Users\eric\Documents\some-project"
Z:\Users\eric\Documents\some-project>node foo.js
fs.js:887
return binding.lstat(pathModule._makeLong(path));
^
Error: UNKNOWN: unknown error, lstat 'Z:\'
at Error (native)
at Object.fs.lstatSync (fs.js:887:18)
at start (fs.js:1495:10)
at Object.realpathSync (fs.js:1483:3)
at toRealPath (module.js:126:13)
at Function.Module._findPath (module.js:165:20)
at Function.Module._resolveFilename (module.js:337:25)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
Z:\Users\eric\Documents\some-project>popd
C:\Users\MLM\some-folder>
\\ERIC-MACBOOK\eric\
C:\Users\MLM\some-folder>node "\\ERIC-MACBOOK\eric\Documents\some-project\foo.js"
foo
C:\Users\MLM\some-folder>pushd "\\ERIC-MACBOOK\eric\Documents\some-project"
Z:\Documents\some-project>node foo.js
foo
Z:\Documents\some-project>popd
C:\Users\MLM\some-folder>
Related issues:
