PeteLawrence/homebridge-people

Error: EACCES: permission denied

Opened this issue · 6 comments

GPL71 commented

Hello
Thank you for your work!!!

Please can you help me solve follow problem?
User is "pi"
Thank you

[2019-9-2 19:02:14] Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/homebridge-people/node_modules/node-persist/storage'
at Object.fs.mkdirSync (fs.js:902:18)
at sync (/usr/local/lib/node_modules/homebridge-people/node_modules/mkdirp/index.js:55:12)
at sync (/usr/local/lib/node_modules/homebridge-people/node_modules/mkdirp/index.js:61:24)
at Function.sync (/usr/local/lib/node_modules/homebridge-people/node_modules/mkdirp/index.js:61:24)
at LocalStorage.parseDirSync (/usr/local/lib/node_modules/homebridge-people/node_modules/node-persist/local-storage.js:615:20)
at LocalStorage.parseDataDirSync (/usr/local/lib/node_modules/homebridge-people/node_modules/node-persist/local-storage.js:545:21)
at LocalStorage.initSync (/usr/local/lib/node_modules/homebridge-people/node_modules/node-persist/local-storage.js:145:14)
at Object.nodePersist.initSync (/usr/local/lib/node_modules/homebridge-people/node_modules/node-persist/node-persist.js:41:29)
at new PeoplePlatform (/usr/local/lib/node_modules/homebridge-people/index.js:36:18)
at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:337:32)
at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:90:36)
at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

Run the following code:

$ sudo su
$ chown -R homebridge: chown -R homebridge: /usr/local/lib/node_modules/homebridge-people/

It fixes the permissions as the homebridge-people folder is only granted permissions for root user.

GPL71 commented

not seem works ...
Schermata 2019-11-27 alle 21 37 42

Please can you understanding why?
Thankyou

Run the following code:

$ sudo su
$ chown -R homebridge: chown -R homebridge: /usr/local/lib/node_modules/homebridge-people/

It fixes the permissions as the homebridge-people folder is only granted permissions for root user.

This is not a good idea. You should never "fix" permissions that are granted for the root user. And to run a chown for a user homebridge that might not be available on a specific system is also not a good idea as it results in the error message of @GPL71

The default setting "cacheDirectory": "./.node-persist/storage", is only working then if you run your homebridge as root, which is not a good idea. So the default setting itself is not a good idea.

Unbelievable, this plugin is so great and I love it and it works every day for me but it creates only bad ideas :-D

Set "cacheDirectory": "./.node-persist/storage", to a path where you allowed to write. This is a good idea. If you start homebridge as user pi then /home/pi/.homebridge/node-persist/storage and you should be fine. If you don't know which user you use to start homebridge you could write it to /tmp/node-persist/storage - unfortunately this path is deleted after every reboot of your machine. Good idea? Not sure.

When I look to the code it seems that everything is working automatically when you just set no path. So _"cacheDirectory": "", could be a solution.

chown -R pi: /usr/local/lib/node_modules/homebridge-people/

Thanks.

EACCES: permission denied, unlink '/home/user/Desktop/Git-srch-engine/Github-search-master/dist/Github-search/wwod.jpg'

help plz

SOLVED on Mac by running on terminal:

$ chown -R YourMacUsername: /Users/YourMacUsername/.npm