Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Docker] Husky fail to install on docker image #7136

Closed
Th3S4mur41 opened this issue Jun 15, 2021 · 6 comments
Closed

[BUG] [Docker] Husky fail to install on docker image #7136

Th3S4mur41 opened this issue Jun 15, 2021 · 6 comments
Labels
upstream This is a bug in something playwright depends on, like a browser.

Comments

@Th3S4mur41
Copy link
Contributor

Th3S4mur41 commented Jun 15, 2021

Husky from @typicode is added as devDependency with a prepare script to install the hooks according to documentation.

The prepare step fails on the mcr.microsoft.com/playwright:focal container due to missing permissions.

Github Actions job is configured as follow:

  test:
    runs-on: [self-hosted, linux]
    container: mcr.microsoft.com/playwright:focal
    steps:
      - uses: actions/checkout@v2
      - run: npm ci --no-optional --no-audit --prefer-offline --progress=false
      - run: HOME=/root npm run test:playwright

This is the error ouptut from the CI:

prepare
> husky install

husky - Git hooks failed to install
/__w/project_a/project_a/node_modules/husky/lib/index.js:33
        throw e;
        ^

Error: EACCES: permission denied, mkdir '.husky/_'
    at Object.mkdirSync (node:fs:1324:3)
    at Object.install (/__w/project_a/project_a/node_modules/husky/lib/index.js:23:12)
    at Object.install (/__w/project_a/project_a/node_modules/husky/lib/bin.js:27:41)
    at Object.<anonymous> (/__w/project_a/project_a/node_modules/husky/lib/bin.js:39:22)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '.husky/_'
}
npm ERR! code 1
npm ERR! path /__w/project_a/project_a
npm ERR! command failed
npm ERR! command sh -c husky install

The same script runs fine on e.g. node:lts-buster container

@mxschmitt
Copy link
Member

Would it be possible that you could create a minimum reproducible in form of a GitHub repository for us?

@Th3S4mur41
Copy link
Contributor Author

@mxschmitt I'll give it a try

@Th3S4mur41
Copy link
Contributor Author

There you go 😉
https://github.com/Th3S4mur41/bug-playwright-husky

@mxschmitt
Copy link
Member

mxschmitt commented Jun 15, 2021

I was able to track it a little bit down. When using Node.js 14/15 inside the Docker container, it works correctly. You can install Node.js 14 there with the following commands:

apt-get remove nodejs
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs

Related links:

@mxschmitt mxschmitt added upstream This is a bug in something playwright depends on, like a browser. and removed triaging labels Jun 15, 2021
@mxschmitt mxschmitt changed the title [BUG] Husky fail to install on docker image [BUG] [Docker] Husky fail to install on docker image Jun 15, 2021
@Th3S4mur41
Copy link
Contributor Author

I used

- uses: actions/setup-node@v2 
        with:
          node-version: '14'

Works too 😀
Thanks

@mxschmitt
Copy link
Member

Closed since we switched to Node.js 14 in #7212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream This is a bug in something playwright depends on, like a browser.
Projects
None yet
Development

No branches or pull requests

2 participants