Nodemon: Error: EACCES, permission denied '/root/.config/configstore/update-notifier-nodemon.yml'

Created on 6 Jan 2014  路  23Comments  路  Source: remy/nodemon

It seems that nodemon DO NOT get the right user, when i use supervisor (running under user root) and swith to another user.

For Example,
supervisord.conf
command=/usr/bin/nodemon xxoo.js
user=worker

nodemon still trying to get config from "/root/.config/configstore/update-notifier-nodemon.yml" but NOT "/path/to/user-worker-home/.config/configstore/update-notifier-nodemon.yml"

exception in nodemon killing node
Error: EACCES, permission denied '/root/.config/configstore/update-notifier-nodemon.yml'
You don't have access to this file.

at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object.create.all.get (/usr/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/configstore.js:31:29)
at Object.Configstore (/usr/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/configstore.js:24:40)
at new UpdateNotifier (/usr/lib/node_modules/nodemon/node_modules/update-notifier/lib/update-notifier.js:34:17)
at module.exports (/usr/lib/node_modules/nodemon/node_modules/update-notifier/lib/update-notifier.js:140:23)
at Object.<anonymous> (/usr/lib/node_modules/nodemon/bin/nodemon.js:7:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
bug

Most helpful comment

@shaunstanislaus thanks this worked:
sudo chown -R yourusername /Users/yourusername/.config/configstore/

All 23 comments

Acknowledged.

I'm going to look at removing the update-notifier support - it's caused two open issues now.

Though, I have a feeling that supervisor isn't setting the right environment values. You can test this by sending the result of:

console.log(process.env);

In a script where your user is worker.

I'm having the same problem as WangFubo. Is there a solution or workaround available? Thanks!

Just got hit with this after a fresh install of node and nodemon on a new machine on OSX:

Error: EACCES, permission denied '/Users/johnbrett/.config/configstore/update-notifier-nodemon.yml'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (evalmachine.<anonymous>:500:18)
    at Object.fs.readFileSync (evalmachine.<anonymous>:352:15)
    at Object.create.all.get (/Users/johnbrett/n/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/index.js:34:29)
    at Object.Configstore (/Users/johnbrett/n/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
    at new UpdateNotifier (/Users/johnbrett/n/lib/node_modules/nodemon/node_modules/update-notifier/index.js:33:17)
    at module.exports (/Users/johnbrett/n/lib/node_modules/nodemon/node_modules/update-notifier/index.js:126:23)
    at Object.<anonymous> (/Users/johnbrett/n/lib/node_modules/nodemon/bin/nodemon.js:8:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node /Users/johnbrett/n/bin/nodemon server.js --dump
At http://github.com/remy/nodemon/issues/new
----------------------------------------------------------

Is there any workaround? Tried creating/chown/chmod 777 all giving the same.

Thanks for providing this module also - such a big timesaver!

Me too

Update notifier also blocks spawning multiple nodemon instances. All of instances are trying to write same file at startup.

~/.config/configstore/update-notifier-nodemon.json

I'am not found any correct workaround, because update-notifier uses process username to store its config. If you modify bin/nodemon.js to

require('update-notifier')({
  pkg: defaults(pkg, { version: '0.0.0' }),
  callback: function() { }
}).notify();

everything begins work as expected (not sure its right fix).

Also i found that configstore generates temporary directory for file if no user associated with current process. I think this is exact solution for multiple instances.

Thanks Shaunstanislaus. I fixed it via your way.
My problem is I once ran my code with sudo, then have to use sudo every time since then. but node is ok, just nodemon needs sudo privilege.

sorry, i don't understand it. how can i do it? I don't find any +1 thing.

I just ran into this with a fresh install of nodemon on a fresh install of Ubuntu Server 14.04. Let me know if I can give more details

@shaunstanislaus thanks this worked:
sudo chown -R yourusername /Users/yourusername/.config/configstore/

I hope linux permits nodemon non-root usage, hehe :-)

@shaunstanislaus thanks, had the same problem and your method worked perfectly!

Who wants to get this in the FAQ?

@shaunstanislaus thanks, had the same problem and your method worked perfectly!

I had this issue after running sudo nodemon (because I wanted to try running my local server on port 80)

Thanks @shaunstanislaus that fixed my issue. I had the issue after running sudo with nodemon also.

Same issue on windows, when run as Administrator too. Permissions seem ok.
Restart fixed it, :)

I came across this issue, @shaunstanislaus solution fixed it, but then it happened again a couple days later?

Any reason for this? Could it be because of me changing networks (I dont see why)?

Nope! I'll see how it goes this time, hopefully it doesn't happen again. @shaunstanislaus

@shaunstanislaus - I can confirm that the EACCES: permission denied error occurs each time I change to a new network!

As I was writing this I used nodemon with sudo, and it worked without throwing the EACCES: permission denied error. I have a feeling this might be cos I'm running a node app on port :80.

run same code with sudo command i.e:

sudo npm install -g nodemon

It seems nodemon changes the permissions of the file to rw and owner to the active user every time its run. Thus, running first sudo (for port 80) and then normal causes the issue.
Suggested fix would be to edit the file and not its permissions whenever the file needed.
For now, I have an alias fixnodemon that runs chmod 666 on the file so that nodemon can read it no matter what user wants to.

@shaunstanislaus Thanks, your method worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

endquote picture endquote  路  4Comments

piton13 picture piton13  路  3Comments

jagged3dge picture jagged3dge  路  4Comments

binarykitchen picture binarykitchen  路  5Comments

robboerman picture robboerman  路  3Comments