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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With