pnpm / action-setup

Install pnpm package manager
https://github.com/marketplace/actions/setup-pnpm
MIT License
939 stars 89 forks source link

EACCES: permission denied when running in a container w/ non-default user #98

Open FFdhorkin opened 1 year ago

FFdhorkin commented 1 year ago

Cypress docs recommend that if you want to run in a container, you use

container:
   image: cypress/browsers:latest
   options: --user 1001

in your job.

However, this results in a permissions error w/ the pnpm/action-setup github action:

Run pnpm/action-setup@v2
  with:
    version: 8
    dest: ~/setup-pnpm
    run_install: null
    package_json_file: package.json
/usr/local/bin/docker exec  6686201126ed5c34125a267c0082d372fd0e529f00478b06bffe9160dc7665b9 sh -c "cat /etc/*release | grep ^ID"
Error: EACCES: permission denied, open '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'
    at Object.openSync (node:fs:590:3)
    at Object.writeFileSync (node:fs:2202:35)
    at Object.appendFileSync (node:fs:2264:6)
    at Object.issueFileCommand (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:13826)
    at saveState (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:11983)
    at main (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:426)
    at Object.9450 (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:540)
    at __nccwpck_require__ (/__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34263)
    at /__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34448
    at Object.<anonymous> (/__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34492) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'
}
Error: Error: EACCES: permission denied, open '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'

Removing options: --user 1001 solves this, but goes against Cypress's advice regarding permissions.