The error message is telling you that it can't access/save the file. Make sure the user you are running the commands has the proper permissions.
I wondered that too, I was using a user I specifically created for this task in order to not use the root user as I thought it was not a good practice to do. Especially since the instructions indicate a sudo user. Usually I can figure out permission issues, but for some reason I have not been able to solve this one. The installation does get further when using the root user, so there is definitely a permission issue.
The error I get now is related to the connection of the Redis database. I get a connection refused error when using the IP of the server.
The abort error shows the IP address and default port number so I have no idea how to connect the database.
Here's the latest console information ...
[email protected] node_modules/connect-redis
└── [email protected] ([email protected])
25/4 19:08  - info: Populating database with default configs, if not already set...
25/4 19:08  - error: Error: Redis connection to myserverIP:6379 failed - connect ECONNREFUSED
at RedisClient.flush_and_error (/mydomainpath/nodebb/node_modules/redis/index.js:142:13)
at RedisClient.on_error (/mydomainpath/nodebb/node_modules/redis/index.js:180:10)
at Socket.<anonymous> (/mydomainpath/nodebb/node_modules/redis/index.js:95:14)
at Socket.EventEmitter.emit (events.js:95:17)
at process._tickCallback (node.js:415:13)
25/4 19:08  - warn: NodeBB Setup Aborted. Redis connection to myserverIP:6379 failed - connect ECONNREFUSED