[error] Error: Error loading context store: Error: EACCES: permission denied, mkdir '/data'

Hi,
I'm running Node-RED on Debian and needed to change the config.js to

contextStorage: {
        default: {
            module:"localfilesystem",
            config: {
              dir:"/data",
              base:"context",
              cache: true,
              flushInterval: 30
            }
        },
    }, 

To get Netatmo back to work (https://gist.github.com/matz33/843165d0046cac534864b65e633801a5?permalink_comment_id=4785938#gistcomment-4785938).

But when I do so, Node-RED won't start anymore.

When I run sudo service nodered status, the output is

Jul 13 09:57:25 nodered Node-RED[115]: 13 Jul 09:57:25 - [info] Loading palette nodes
Jul 13 09:57:27 nodered Node-RED[115]: 13 Jul 09:57:27 - [info] Dashboard version 1.0.2 started at /ui
Jul 13 09:57:30 nodered Node-RED[115]: 13 Jul 09:57:30 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
Jul 13 09:57:31 nodered Node-RED[115]: 13 Jul 09:57:31 - [info] Settings file : /home/hermiot/.node-red/settings.js
Jul 13 09:57:31 nodered Node-RED[115]: 13 Jul 09:57:31 - [info] Context store : 'default' [module=localfilesystem]
Jul 13 09:57:31 nodered Node-RED[115]: (node:115) V8: /home/hermiot/.node-red/node_modules/@throneless/libsignal-protocol/build/curve25519_concat.js:20225 Invalid asm.js: Expected shift of word size
Jul 13 09:57:31 nodered Node-RED[115]: (Use `node --trace-warnings ...` to show where the warning was created)
Jul 13 09:57:31 nodered Node-RED[115]: 13 Jul 09:57:31 - [error] Failed to start server:
Jul 13 09:57:31 nodered Node-RED[115]: 13 Jul 09:57:31 - [error] Error: Error loading context store: Error: EACCES: permission denied, mkdir '/data'
Jul 13 09:57:31 nodered Node-RED[115]: at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/context/index.js:180:15

Can anybody help please?

Thanks!

How did you install node-red?

I'm pretty sure via npm
https://nodered.org/docs/getting-started/local
Definitely not Docker.

What do you see if you start node red using the command
node-red?

Oh, I see the problem, you have told it to store the config in /data. It needs to be a folder that node red can write to.

You shouldn't need the config section at all, let node red using its defaults. Just use

contextStorage: {
        default: {
            module:"localfilesystem",
        },
    }, 

You have told Node-RED to try to create context data files at /data - the leading / tells the OS to start from the root of the filing system. This is generally a bad idea on Linux systems and won't be accessible to Node-RED by default, you would have to manually create the folder and set its permissions if you really want to do that.

Unless you really want to move it somewhere, best to do as Colin says and let it use the default which is likely to end up at:

~/.node-red/context/
1 Like

Thank you all for pointing me out to the solution :slight_smile:

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