slap-editor / slap

Sublime-like terminal-based text editor
MIT License
6.14k stars 216 forks source link

Fatal Error: EACCES: permission denied #278

Open JesusLeon opened 8 years ago

JesusLeon commented 8 years ago

Hello,

I know this may not be an issue specific to Slap, but it happens to me only on this package. Whenever I tried to open slap I get the following message:

Fatal Error: EACCES: permission denied, open /Users/{user}/.config/configstore/update-notifier-slap.json

What would be the right way to correct this? I've installed it as specified in the README (using sudo), would that be the issue?

Thanks.

dbkaplun commented 8 years ago

@JesusLeon what does ls -al /Users/{user}/.config/configstore/update-notifier-slap.json say, or if it gives you permission denied what does ls -al {closest parent directory to update-notifier-slap.json that doesn't give you permission denied} say?

JesusLeon commented 8 years ago

Hi @dbkaplun,

thanks for the answer. The first command gives me -rw------- 1 Jesus staff. But I remember changing the owner manually to mine in order to avoid this. But at some point it just returns to whatever it was (probably root) and shows me the error. Maybe I have to wait to compare (?)

dbkaplun commented 8 years ago

@JesusLeon as long as you can read and write to the file it should work. slap uses the permissions of the user that runs it, rather than the permissions of the user that installed it. Can you try chmod 777 /Users/{user}/.config/configstore/update-notifier-slap.json and try again?

JesusLeon commented 8 years ago

Hi @dbkaplun, thanks, I did that and is working fine.

The strange thing is that suddenly I have (and will have) that error again. Something changes the permissions somehow. Could it be another Node (perhaps global) command somewhere else? Maybe a node or npm update. Don't know yet.

jimbojw commented 8 years ago

The root cause of this issue (and many like it) is probably https://github.com/npm/write-file-atomic/issues/11.

There is an outstanding patch which will fix this for everyone. We're all waiting for someone from npm to accept it: https://github.com/npm/write-file-atomic/pull/13