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

Error: stat /dev/null/pre-push: not a directory 32.06  ELIFECYCLE  Command failed with exit code 1. #669

Open
xuelichao opened this issue Mar 6, 2024 · 2 comments
Labels
bug Something isn't working waiting for response We need more details or confirmation

Comments

@xuelichao
Copy link

xuelichao commented Mar 6, 2024

🔧 Summary

This error happens when execute 'lefthook install' command in a docker build command with a react UI project.(in CICD ENV)

However, we can not encounter the same error in local PC when manually build an image with docker command.

The command pre-push is located at .git/command not the location '/dev/null/pre-push'

It seems that the method to get the command(pre-push) location(dir) is not correct in some conditions.

Lefthook version 1.5.0/1.6.5

Steps to reproduce

docker build --no-cache --network=host --pull --build-arg GOPROXY= --build-arg VERSION= --build-arg GIT_COMMIT= -t -f ./Dockerfile.test .

Dockerfile.test:
RUN pnpm i

package.json:
"prepare": "lefthook install",

Expected results

The command 'RUN pnpm i ' should be executed successfully and image should be built successfullly.

Actual results

Error: stat /dev/null/pre-push: not a directory 32.06  ELIFECYCLE  Command failed with exit code 1.

Possible Solution

Logs / Screenshots

LEFTHOOK_VERBOSE=true git ...
@xuelichao xuelichao added the bug Something isn't working label Mar 6, 2024
@mrexox
Copy link
Member

mrexox commented Mar 6, 2024

Please, don't install lefthook in the CI environment. I think you should explicitly specify this in your prepare script. Something like this:

"prepare": "[ -z $CI ] && lefthook install"

And if you use lefthook npm package it already handles this out of the box. You don't need an explicit lefthook install in the prepare script.

@mrexox
Copy link
Member

mrexox commented Apr 9, 2024

Hey! Do you still have issues with lefthook auto install?

@mrexox mrexox added the waiting for response We need more details or confirmation label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response We need more details or confirmation
Projects
None yet
Development

No branches or pull requests

2 participants