# Trouble writing to SMB files/directories

**URL:** <https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659>\
**Category:** General\
**Created:** [17 March 2023 10:30 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659 "2023-03-17T10:30:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [17 March 2023 10:30 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/1 "2023-03-17T10:30:58Z")

</div>

I have a small QNAP server which I access from Windows 10.  
I am running node red on my PC.

Although I can access my QNAP shares as normal drive letters, and create files, directories etc from all the usual utilities, whenever I use node-red to try to write or copy a file using the standard nodes or the node-red-contrib-filesystem nodes, I get an error of the following form:

`ENOENT: no such file or directory`

Does anyone have any ideas?

Thanks

B.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 March 2023 11:07 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/2 "2023-03-17T11:07:28Z")

</div>

How are you running Node-RED on the Windows PC? Are you running it with the same user account as your standard login? And when does it start? Do you start it _before_ any user login?

Also, within a flow, use an exec node to do a `pwd` command and a directory listing to see what results you get.

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [17 March 2023 12:20 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/3 "2023-03-17T12:20:43Z")

</div>

Hi, thanks for the reply.

I use a CMD window to issue the "node-red" command. So it's running in my user context.

a cd (not pwd!) command displays, for some reason, the windows/system32 directory, but that's really a factor.

The point is my username has write access to the Qnap smb shares via the drive letter: path, so why can't node-red see the same path?

B.

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [17 March 2023 12:39 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/4 "2023-03-17T12:39:35Z")

</div>

Looks like the problem is accessing mounted shares!

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [17 March 2023 12:52 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/5 "2023-03-17T12:52:28Z")

</div>

Success.

Apparently the solution is to specify the files in UNC format. Drive letter mappings don't work!

Can someone tell me if it is possible to use drive letter mappings by some other clever means?  
E.g. @knolleary ?

Thanks!

B.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 March 2023 13:39 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/6 "2023-03-17T13:39:20Z")

</div>

> [@bwims](#):
>
> Drive letter mappings don't work!

Wait one while I try - but I'm pretty certain they do work.

Correction - wait 10 while I fix my network shares that appear to have been broken by the upgrade from W10 to W11! ☹

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [18 March 2023 10:35 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/7 "2023-03-18T10:35:22Z")

</div>

I did a search for drive letter mappings and found this, which implies it is a general problem

[shared folders in windows](https://discourse.nodered.org/t/shared-folders-in-windows-10/14655)

and this

[Node-red running on Windows accessing File on NAS](https://discourse.nodered.org/t/node-red-running-on-windows-accessing-file-on-nas/33292/2)

and no success other than using a UNC, so I guess that clears it up for me.

I suggest an addition to the document [Running on Windows](https://nodered.org/docs/getting-started/windows) which includes the little wrinkles you might come across actually running **flows** on Windows, rather than just getting Node Red running on Windows.

@knolleary  
The drive letter concept is (sadly considering Windows NT came from Vax/VMS) an inherent part of Windows. Using them for mapped drives clearly doesn't work, so I do think a worked example of using the UNC notation (preferably with forward slashes) ought to be included in that document.

Thanks!

B.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2023 12:31 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/8 "2023-03-18T12:31:10Z")

</div>

> [@bwims](#):
>
> I did a search for drive letter mappings and found this, which implies it is a general problem

Sorry, I had a problem with a rogue file share yesterday and didn't get back to this. Tried today with this flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0fbb50cfaa680c7f79f26638aa44272765799405.png)

This is running on my Windows PC and the Z: share points to the root folder of my Debian Linux server.

It works perfectly as I stated I thought it would in my first post.

This variation also works perfectly:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/2/e2ab0c55a626c32db9493347d8a3f53b0c936ad9.png)

In case you think that is unique to just the file-in node - here are some examples with an exec:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1bf5bf4fbb5ce3b86b66ecb0b2b726a0e3130b8.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a90e57f7475a566c6bc0aff0ac84745f52d14ba.png)

And they also work just fine.

So the `/` vs `\` is not the issue.

> [@bwims](#):
>
> Apparently the solution is to specify the files in UNC format. Drive letter mappings don't work!

This is incorrect as shown above.

> [@bwims](#):
>
> implies it is a general problem

It might have been at one time, but no longer.

> [@bwims](#):
>
> Windows NT came from Vax/VMS

Sorry to be pedantic but Windows/NT's origin lies with IBM and OS/2. In fact, I well remember those days and did a lot of work with OS/2 before moving on to Windows.

> [@bwims](#):
>
> Using them for mapped drives clearly doesn't work

It does most certainly work. As does UNC access.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 March 2023 13:00 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/9 "2023-03-18T13:00:22Z")

</div>

> [@TotallyInformation](#):
>
> did a lot of work with OS/2

#offtopic - ah happy days

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [18 March 2023 14:37 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/10 "2023-03-18T14:37:38Z")

</div>

Interesting.

I just ran a test on my old windows machine, and the problem does _ **not** _ occur there.

The only difference that I can see is that

Node Red V3.0.1 is installed on the new machine, but V3.0.0. on the old one.

Node.js is v16.16.0 on both

Where to go from here? As you can see, other people have had this problem, with apparently no resolution.  
🤔

B.

-------------- PS ------------------  
Off topic.

If you are going to be pedantic, you need all the facts! 🙃

MS and IBM split before work started on NT. MS hired Dave Cutler from Digital Equip. who was a Vax/VMS author. He didn't like OS/2 and modelled the underlying op sys on Mica, the next stage of VMS. Although I'm normally sceptical of Wikipedia, I was familiar with the issues at the time and find their accounts [here](https://en.wikipedia.org/wiki/Windows_NT) and [here](https://en.wikipedia.org/wiki/OS/2) and [here](https://en.wikipedia.org/wiki/Dave_Cutler) to be quite good.

(My off the cuff remark was that 45 years ago I was working with VMS which had dynamic logical names with which you could point at a disk or subtree - as many as you want - and here we are in the 21st century still using 20+ letters of the alphabet...)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2023 15:12 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/11 "2023-03-18T15:12:00Z")

</div>

> [@bwims](#):
>
> Where to go from here? As you can see, other people have had this problem, with apparently no resolution.

I'm using Windows 11 as it happens but the same still works for W10. I'm also using the latest beta but I tested on a clean install of Node-RED v3.0.2 as well. I'm using Node.js v16.14.0

I also just tested with my Synology NAS just in case something was different but that works as well.

So we are back to trying to understand what is different between running something in Node-RED and running from the command line.

So two things. Can you please create a dummy file in the root of one of your shared drives and try to read it from Node-RED using a simple flow: trigger-\>file-read-\>debug. Then can you share the flow here so I can try it on my system?

Secondly, are you using DOS or PowerShell for the command line and if PowerShell, which version?

* * *

> [@bwims](#):
>
> If you are going to be pedantic, you need all the facts!

I did in fact check the facts before posting 😁 I did see a reference to Dave Cutler but the bulk of the OS was indeed developed initially with IBM. Shades of LAN Manager included as well of course. So doubtless the actual truth is a mix of all of these things.

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [18 March 2023 15:40 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/12 "2023-03-18T15:40:50Z")

</div>

Ok, here is the flow:

```auto
[
    {
        "id": "b7788b76618998c9",
        "type": "inject",
        "z": "abf5ea63e2bde491",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 150,
        "y": 220,
        "wires": [
            [
                "cc8509fa75f8b090"
            ]
        ]
    },
    {
        "id": "1305f97d9387aa79",
        "type": "debug",
        "z": "abf5ea63e2bde491",
        "name": "debug 19",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 540,
        "y": 220,
        "wires": []
    },
    {
        "id": "cc8509fa75f8b090",
        "type": "file in",
        "z": "abf5ea63e2bde491",
        "name": "",
        "filename": "z:\\test.txt",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 340,
        "y": 220,
        "wires": [
            [
                "1305f97d9387aa79"
            ]
        ]
    }
]

```

Looks like this

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c42eafd1bbe01ca54a5cf43f651dffd2b30a7cd4.png)

Output on the failing computer:

```auto
18/03/2023, 15:29:34[node: cc8509fa75f8b090](http://localhost:1880/#)
msg : error

"Error: ENOENT: no such file or directory, open

```

Output on the succeeding computer:

```auto
18/03/2023, 15:31:09[node: debug 19](http://pavilion.local:1880/#)
msg.payload : string[32]

"This is not a test! It's a pipe!"

```

On both nodes, after a boot, I create an unprivileged CMD window and issue the command node-red

When you said this:

> So we are back to trying to understand what is different between running something in Node-RED and running from the command line.

I'm not clear what you mean. I'm doing what seems to me to be identical operations on both computers. The older computer is running an earlier point version of Windows 10, but you are running Windows 11, so it can't be that.

Anyway, thanks very much for taking to the time to help me!

B.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2023 15:56 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/13 "2023-03-18T15:56:06Z")

</div>

> [@bwims](#):
>
> Looks like this

Had to change the drive letter but:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4c7a6ba3d526f4fb64e521ae48d072644b6e303f.png)

Try this flow please:

```auto
[{"id":"9fa234d59f68ae6b","type":"inject","z":"d9f4668b3c173eb8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":870,"y":160,"wires":[["7a72e7e623b9ece2"]]},{"id":"d2744dce77db82b0","type":"debug","z":"d9f4668b3c173eb8","name":"debug 109","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1300,"y":160,"wires":[]},{"id":"7a72e7e623b9ece2","type":"exec","z":"d9f4668b3c173eb8","command":"dir z:\\","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":1070,"y":160,"wires":[["d2744dce77db82b0"],["d2744dce77db82b0"],["d2744dce77db82b0"]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e890bbef83b9858d01a4c8f9ac6d5d6fbf9df3b.png)

Could you then please do a `net use` command both from the cmd line and from the Node-RED exec node?

> [@bwims](#):
>
> I'm not clear what you mean. I'm doing what seems to me to be identical operations on both computers.

And that is, where I suspect the problem lies. `seems` might not actually be the same. But I can't quite work out why. Something about how node-red is running on the failing computer seems to be hiding

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2023 15:57 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/14 "2023-03-18T15:57:31Z")

</div>

Oh, and you should update the failing machine to node-red v3.0.2 as well.

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [18 March 2023 15:58 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/15 "2023-03-18T15:58:47Z")

</div>

Did you check if node-red runs for whatever reason elevated? Because that might under windows also lead to not seeing a file share that is created by a user.

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [18 March 2023 15:59 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/16 "2023-03-18T15:59:13Z")

</div>

Before I start those tests, FYI I tried the flow on 2 other systems: One was a docker system on the same failing machine using WSL and that failed with the same problem

The other system was a windows laptop running an old version of node red 1.1.3 and that worked.

---

<div class="post-metadata">

**Author:** ![bwims](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bwims/32/64907_2.png) [@bwims](https://discourse.nodered.org/u/bwims)\
**Post date:** [18 March 2023 16:08 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/17 "2023-03-18T16:08:34Z")

</div>

Thanks for the suggestion...

{hangs head in shame}

I did, indeed start it off in a privileged window. What a complete and utter fool!

Thanks so much for cracking the problem.

Thanks also to @TotallyInformation too!

Just off to the foot of my stairs....

B.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2023 17:27 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/18 "2023-03-18T17:27:45Z")

</div>

Well spotted @cameo69 - annoyed with myself that I didn't think of that!

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [18 March 2023 21:48 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/19 "2023-03-18T21:48:52Z")

</div>

Don‘t be, I am just reading and sometimes it is easy to spot things from a distance. And you guys here in the forum are helping a lot of people.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 May 2023 21:49 UTC](https://discourse.nodered.org/t/trouble-writing-to-smb-files-directories/76659/20 "2023-05-17T21:49:28Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
