azerothcore / acore-docker

docker-compose example to run an azerothcore platform
https://www.azerothcore.org/acore-docker/
GNU Affero General Public License v3.0
212 stars 82 forks source link

NPM permission issues #23

Closed Moon-developer closed 1 year ago

Moon-developer commented 1 year ago

I followed a suggestion to fix one of the containers not starting due to index permission. But I'm noticing that the acore-docker-ac-eluna-ts-dev-1 container is spitting out the following error now:

npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm WARN logfile  error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
npm WARN logfile   errno: -13,
npm WARN logfile   code: 'EACCES',
npm WARN logfile   syscall: 'scandir',
npm WARN logfile   path: '/root/.npm/_logs'
npm WARN logfile }
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /root/.npm/_cacache/tmp
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1000:1000 "/root/.npm"

npm ERR! Log files were not written due to an error writing to the directory: /root/.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

Any idea how to fix this? It seems to be a directory in the container but I can't access it when it's in a restart loop.

Helias commented 1 year ago

that's weird, it seems a permissions issue, you could try to run inside the docker container sudo chown -R 1000:1000 "/root/.npm" as it is suggested from npm, or add this command into the Dockerfile of docker-ac-eluna-ts-dev

michaeldelago commented 1 year ago

I was able to replicate this with a root-owned scripts directory.

To fix this, you should make the /path/to/acore-docker/scripts directory accessible by the 1000 user. Either command chown -R 1000:1000 ./scripts or chmod -R 777 ./scripts should work here.

If you still have the override suggested in https://github.com/azerothcore/acore-docker/issues/14#issuecomment-1411643547, you can remove that.

Moon-developer commented 1 year ago

Thank you, will try this later today and report back here.