Error: EACCES: permission denied

According to this instruction: A guide to understanding 'Persistent Context'
I changed the settings in the settings.js file
I just uncommented some lines.

And now I have this

    // Context Storage
    // The following property can be used to enable context storage. The configuration
    // provided here will enable file-based context that flushes to disk every 30 seconds.
    // Refer to the documentation for further options: https://nodered.org/docs/api/context/
    //
    contextStorage: {
       default: {
           module:"localfilesystem"
       },
    },

And now in debug window write an error at regular intervals: "Error writing context: Error: EACCES: permission denied, mkdir '/home/user/.node-red/context/c58788ff.b5f1a8'"

How to find out, what rights should i need to give? and to whom?

What OS are you running and how did you install node-red?

Start node-red in a terminal (stop node red then use node-red-start if that command exists) and post the resulting output here. Use the </> button and paste it in.

Also show use what ls -l /home/user/.node-red/context gives, and if that directory does not exist then ls -l /home/user/.node-red
One possibility is that you have been using sudo when you shouldn't and have ended up with files owned by root in your home directory.

2 Likes

You have an extra comma creating an invalid object.

The example was

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

when you removed the default line you needed to remove the comma fron the storeInFile line so you have

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

This is a simple error that I've made more than once :grin:

So have I, but I don't think that is what is causing the problem, nodejs seems fairly tolerant of this particular syntax error. Certainly it should be fixed though.

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