12

Having issues of reading/writing to a UNC path with nodeJs on my local machine. At one point fs was read/writing from my machine to the UNC path just fine, but now it appears that it cannot read/write to it.

UNC Path : \\[machine name]\folder1\folder2\file.csv

I upgraded to node version 12 awhile back and thought perhaps there is a network path bug, but not seeing anyone online affected. I then used nvmw to load an older version of node and still nothing.

I wondered if it was because I was not joined to the same domain, however, that was not an issue before. I can ping the box, access in windows explorer, remote in.

I have tried running my app as my user, as admin, added a windows credential for network admin in credential manager.

Tried changing the flags used for permissions r, r+, a, a+ 0666...

Paths Tried

  • \\[machine name]\
  • \\?\[machine name]\
  • \\?\UNC\[machine name]\

Write Error

{ 
  [Error: UNKNOWN, mkdir '\\[machine name]\Storage\CSV\Example.csv']
  errno: -4094,
  code: 'UNKNOWN',
  path: '\\[machine name]\Storage\CSV\Example.csv' 
}

Read Error

{ 
  [Error: UNKNOWN, open '\\[machine name]\Storage\CSV\Example.csv']
  errno: -4094,
  code: 'UNKNOWN',
  path: '\\[machine name]\Storage\CSV\Example.csv' 
}

I have walked through a lot of the actual fs code and it seems to ultimately generate the appropriate path but doesnt seem to vibe well with the windows for accessing the UNC path.

I am hoping someone can give me a few pointers of things to check or possible reasons for this.

Hemangi Pithava
  • 138
  • 1
  • 7
afreeland
  • 3,889
  • 3
  • 31
  • 42
  • Maybe related: https://github.com/joyent/node/issues/8821#issuecomment-77834980 – Matthew Bakaitis Apr 02 '15 at 15:17
  • 1
    Not sure. I ended up deleting virtual network connections...and entirely resetting my network adapter and all of a sudden it was back up and writing files. I dont know if those are what fixed it or not. It has been a crummy thing to try and figure out though – afreeland Apr 03 '15 at 14:17
  • I ran into this too, but I was able to use a drive it was already mapped to instead (although it's not hard to add one) – 1j01 May 06 '15 at 21:12
  • You mean you're on node `0.12`? Try 7... Might be fixed there now? – Dominik Jul 08 '17 at 09:27

1 Answers1

4

As you know in node, the backslash is the escape character, so you will need to double the number of backslashes you use. For:

\\machine name\folder1\folder2\filename.ext

try:

\\\\machine name\\folder1\\folder2\\filename.ext
NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70
Anthony S
  • 41
  • 1
  • 5