Read file node - read from file does not work

Hello, I am trying to read from file using read node, but it doesn´t work, I got this message error: "Error: ENOENT: no such file or directory, open 'C:\Users\Admin\Desktop\NR_read.txt'".

I am using NR v 2.2.2 on Win 10 pro.

Write node works perfectly, only reading does not work.

Try using / in your paths rather than \

Also, what user account is running node-red and does it actually have access to the read file?

Additionally, if you add a 2nd "inject --> file in node" flow to try and read the file node-red wrote, does that work?

Thanks for suggestions guys. Tried to change the slashes but doesn´t work. Noticed that in debugger the error message still appears with original slashes.

The node-red is running on local admin user account.

I tried Steve´s suggestion and it works. I am able to read from the file which I created by write node before.

ENOENT

In which case the read file quite possibly has different permissions (copied/pasted from somewhere secure?) OR it is locked by another application.

In basic terms...

  • Dont use "desktop" folders.
  • Always use something suitable secured (or suitably insecure) e.g. c:\import with read/write permissions for the account that runs node-red.
  • Avoid Spaces & punctuation in directory names
  • Enable viewing of file extensions (ALWAYS) god knows why MS thought it was a good idea to hide them by default!

I found out the last point was the issue -> hidden file extensions... really dumb mistake.

Thank you all guys for support!

1 Like

No - a really dump mistake was me yesterday trying to write a file from Node-RED onto my Windows machine and it just not working at all :frowning:

After an hour, I found the issue - the actual NR instance I was using was running on my Pi4..............

:face_with_open_eyes_and_hand_over_mouth:

4 Likes

Beats me why anyone runs Node-red on Windows since Raspberries are available! :stuck_out_tongue_winking_eye:

My main machine is Windows so I use it for testing out new NR betas and stuff like that - I run my real NR IoT stuff on Pi scattered around the house

1 Like

I'm stuck on windows to provide diversity & a testing env (when needed) as my colleagues are on MAC and Linux. Boo hoo. I swore after leaving my last job (which was MS only camp) I would switch back to Linux. No such luck for me haha.

But like Simon, the windows box is for dev time, PI is for runtime. :+1:

For decades I've been vowing to switch to Linux but my current laptop came with WIndows on it.

I only had to add MobaXterm to get a decent local command line and ssh client to access the Linux machines.

I think that Raspberry Pi is perfect for a small scale Node-red server.
I've installed NR on Windows and Android, not found those as convenient.

For my linux fix, I actually run WSL2 on Windows 11.

You can even do GUI apps now.

I also run node-red in WSL Ubuntu & run VSCode natively in windows & connect to the Ubuntu (and the PI) via SSH - its a reasonable compromise.

Oh, a war it is you want?!

I use it on Windows for 3 reasons.

  1. Windows is my primary work and development device and I live on it.
  2. Sometimes I want to do things on Windows and Node-RED is a useful tool.
  3. When developing things, it is sensible to know that it works on Windows, Linux and Mac. I have all 3 around me.

Well at least you can run a quite credible version of Linux nearly natively in Windows using WSL :slight_smile:

I keep trying Linux desktop every few years. And it always stinks. It is at least now perfectly acceptable for people who just need a browser and some simple tools. But for anything complex, you inevitably seem to end up stuck under the bonnet trying to work out why the engine isn't doing what you asked or wanted and then realising that you have to take the engine out to get to the part you need to tweak.

WSL is even better. For some strange reason, it is far faster to use the WSL version of SSH to access remote servers than using the native Windows SSH. Odd.

And with Windows Terminal, you finally have a credible terminal environment that doesn't suck. I've actually dropped my use of Kitty (a PuTTY clone) completely, no longer needed. And with VScode remote editing, I rarely need WinSCP either.

It has certainly revolutionised home servers, so much for so little cost. Of course, I've repurposed an old laptop which has replaced 3 Pi's :slight_smile: More convenient and I can reuse the Pi's for other things.

NR on Windows is fine once you've done the initial setup. Just like on Linux except that you don't have the benefit of Dave's script if you are using that. I run dev environments using PM2 with a nice config to auto-restart on file changes. And I use npm scripts so I don't have to remember the PM2 commands!

I keep thinking it is time to run a master instance of Node-RED as a service, especially as I've (after many years) moved back to a TinyPC desktop rather than a laptop for my daily driver (not getting out much thanks to COVID). I'll get round to it eventually I guess. Especially if some of my current thoughts around uibuilder and dynamic web UI's come together (knowledge-base and task/project management systems come to mind).

:+1: Though I'm still on W10, took a quick look at W11 early release but there was a lot missing. I think its got quite a bit better already but I've not had time to look. Not made any easier with 1/2 dozen or so laptops I have to keep updated!

I do have a Docker remote desktop running on my home server in case I ever feel the need to slum it and use a Linux desktop :slight_smile:

VSCode is now one of my most used tools and stays open most of the time. Its support for Jupyter notebooks is also great.

No thanks!

It's perfectly sensible to run software on whatever platform one needs or feels comfortable with.

Node-red is admirably multi-platform.

Haha, any mention of operating systems and favourites always produces a "robust" discussion! :grinning:

(seeing as we are fully off topic... my latest fav windows tool is Mobaxterm - https://mobaxterm.mobatek.net/ - combines multiple ssh,scp and drag drop all in one app - and can do rdp, x sessions etc.

Beats me why anyone runs Node-red on Windows since Raspberries are available! :stuck_out_tongue_winking_eye:

some of us need to use Windows because the company we work for is a "Microsoft house". (Not my words) There is apparently some pride involved in exclusivity and being strapped into what ever Microsoft is up to.

I'm just glad that this works in Windows, still.