medic / cht-watchdog

Configuration for deploying a monitoring/alerting stack for CHT
GNU Affero General Public License v3.0
4 stars 7 forks source link

Fake CHT: Error: EACCES: permission denied, mkdir #17

Closed mrjones-plip closed 1 year ago

mrjones-plip commented 1 year ago

I get an error when I follow the steps to run the Fake CHT:

fake-cht_1       | npm ERR! code EACCES
fake-cht_1       | npm ERR! syscall mkdir
fake-cht_1       | npm ERR! path /home/node/app/node_modules
fake-cht_1       | npm ERR! errno -13
fake-cht_1       | npm ERR! Error: EACCES: permission denied, mkdir '/home/node/app/node_modules'
fake-cht_1       | npm ERR!  [Error: EACCES: permission denied, mkdir '/home/node/app/node_modules'] {
fake-cht_1       | npm ERR!   errno: -13,
fake-cht_1       | npm ERR!   code: 'EACCES',
fake-cht_1       | npm ERR!   syscall: 'mkdir',
fake-cht_1       | npm ERR!   path: '/home/node/app/node_modules'
fake-cht_1       | npm ERR! }
fake-cht_1       | npm ERR! 
fake-cht_1       | npm ERR! The operation was rejected by your operating system.
fake-cht_1       | npm ERR! It is likely you do not have the permissions to access this file as the current user
fake-cht_1       | npm ERR! 
fake-cht_1       | npm ERR! If you believe this might be a permissions issue, please double-check the
fake-cht_1       | npm ERR! permissions of the file and its containing directories, or try running
fake-cht_1       | npm ERR! the command again as root/Administrator.
fake-cht_1       | 
fake-cht_1       | npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2023-04-13T05_48_40_918Z-debug-0.log
jkuester commented 1 year ago

@mrjones-plip I got a very similar error when running the latest from main:

npm ERR! code EACCES
2023-04-21T18:50:06.749013326Z npm ERR! syscall open
2023-04-21T18:50:06.749165537Z npm ERR! path /home/node/app/package-lock.json
2023-04-21T18:50:06.749485831Z npm ERR! errno -13
2023-04-21T18:50:06.751328210Z npm ERR! Error: EACCES: permission denied, open '/home/node/app/package-lock.json'
2023-04-21T18:50:06.751338933Z npm ERR!  [Error: EACCES: permission denied, open '/home/node/app/package-lock.json'] {
2023-04-21T18:50:06.751414290Z npm ERR!   errno: -13,
2023-04-21T18:50:06.751431295Z npm ERR!   code: 'EACCES',
2023-04-21T18:50:06.751445770Z npm ERR!   syscall: 'open',
2023-04-21T18:50:06.751465183Z npm ERR!   path: '/home/node/app/package-lock.json'
2023-04-21T18:50:06.751482141Z npm ERR! }
2023-04-21T18:50:06.751524014Z npm ERR! 
2023-04-21T18:50:06.751547062Z npm ERR! The operation was rejected by your operating system.
2023-04-21T18:50:06.751559056Z npm ERR! It is likely you do not have the permissions to access this file as the current user
2023-04-21T18:50:06.751573219Z npm ERR! 
2023-04-21T18:50:06.751578482Z npm ERR! If you believe this might be a permissions issue, please double-check the
2023-04-21T18:50:06.751589524Z npm ERR! permissions of the file and its containing directories, or try running
2023-04-21T18:50:06.751607345Z npm ERR! the command again as root/Administrator.
2023-04-21T18:50:06.752914701Z 
2023-04-21T18:50:06.752978777Z npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2023-04-21T18_50_06_645Z-debug-0.log

However, it turns out this was just because the volume path needed to be updated in docker-compose.fake-cht.yml. Can you try again with a completely fresh checkout of https://github.com/medic/cht-monitoring/tree/20_fix_internal_links and see if you still face the same issue?

mrjones-plip commented 1 year ago

hrm - that is not a fix for me - I still get the error. Here's exact steps I took (from bash history). Note that gco is a Oh My Zsh short hand for git checkout origin:

git clone git@github.com:medic/cht-monitoring.git deleteme
cd deleteme
gco 20_fix_internal_links
cp cht-instances.example.yml cht-instances.yml\ncp grafana/grafana.example.ini grafana/grafana.ini\nmkdir -p grafana/data && mkdir  -p prometheus/data \nsudo apt install -y wamerican  # ensures /usr/share/dict/words is present for shuf call below \ncp .env.example .env\n
vim cht-instances.yml
docker compose -f docker-compose.yml -f development/fake-cht/docker-compose.fake-cht.yml up -d
docker kill $(docker ps -q)
docker logs deleteme-fake-cht-1
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/node/app/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/home/node/app/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/home/node/app/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/node/app/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
jkuester commented 1 year ago

So weird! I can follow the exact same steps and it works fine for me. :thinking:

mrjones-plip commented 1 year ago

so...you know, we have this in the docker-compose.fake-cht.yml:

volumes:
  - ./development/fake-cht:/home/node/app

So I just hit with some chmod and it was happy :shrug:

chmod 777 development/fake-cht/package*
chmod 777 development/fake-cht/last-response.json

But 775 wasn't enough FYI!