Node: "read file" debug: Error: EACCES: permission denied, open 'x.json'"

Hello,
i am very new and I hope someone can help me. I am using a Linux system with IO-Broker and Node-Red. Everything is running on the newest version. I created a ".json" on my linux system under "/home/user/x.json". I am trying to read the file inside Node-Red and I am always getting the following fault: "Error: EACCES: permission denied, open '/home/user/x.json'".

I did not find any solution in the internet. It always seem to be another "EACCES" fault. I hope someone can help me out?

My target is to read a .json file and use the information in node-red.

I saw this post here: Node-red-contrib-persist on DietPi : EACCES: permission denied, open '/root/data/persistence.json' - #46 by devifast

but my /mnt folder is empty.

Thank you in advance :slight_smile:

Welcome to the forum @Bitmage77

Is node-red running in a Docker container? If so then probably it does not have access to that part of the file system. I avoid docker whenever possible, it can make life difficult,

Hello,

thank you for your fast reply. I did not expect that tbh.

No, I am not using a docker container. I read about, but I did not understand it, so I decided to not use it :smiley:

How did you install node red?

I installed it via IO-Broker. As an adapter.

This is my path: /opt/iobroker/iobroker-data/node-red

I have a "settings.js" file inside the node-red folder path. Do I need to change something there maybe?

If it is not running in a container (I don't know anything about iobroker) then that suggests that the user running node red does not have read access to the folder. What does this command show
ls -l /home/user/x.json
Is it actually user or are you just showing us that rather than the user name?

  • rwxrwxrwx l user user 65

This means ful access, right?

yes, I dont want to show my real user name thats why we use "User" here

Yes, that means full access rights to anyone, which is odd. I don't know enough about io broker or io broker adapters to know how node red is installed and run to be sure what to do next. If there is an io broker forum I suggest you ask there.

I still suspect that node-red is running inside a container. What does this command show?
which node-red

I typed "which node-red" in my terminal. Nothing happened.
I ran the command in my terminal under /opt/iobroker/iobroker-data/node-red and nothing happened.

Or what do you mean? My node-red version is v4.0.3.
Thank you for your help. I am really stuck here.

That is not a valid node-red version. 3.1.0 is the current/latest. That is probably the version iobroker gave to the wrapper for embedding node-red.

This is likely due to how iobroker embeds and executes node-red. I don't think there are many folks here that run node-red that way.

If they have a forum, you may get more relatable advice there?

Or perhaps update the title of this post to include iobroker (to attract the users who are more familiar with how they do things?)

1 Like

As a workaround, can you put the file under the directory where the node-red flow file is stored? It must have access to that area. Hopefully you know where that is in order to backup your flows file.

The flow files might not be (directly) on a file system - they may be in a database or accessed via an endpoint (storage is pluggable, FlowFuse does this)

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