turbo
turbo copied to clipboard
ERROR failed to calculate global hash: error hashing files
What version of Turborepo are you using?
1.2.4
What package manager are you using / does the bug impact?
npm
What operating system are you using?
Mac
Describe the Bug
I keep getting this error when trying to deploy turborepo on vercel
ERROR failed to calculate global hash: error hashing files. make sure that
git has been initialized failed to hash files/vercel/path0/package.json,
/vercel/path0/package-lock.json: git hash-object exited with status: exit status 128
Expected Behavior
Get a succesful deployment
To Reproduce
I have set up this command on Vercel
cd ../.. && npx turbo run build --filter=medusa-admin --include-dependencies --no-deps
And my turborepo is set uo like this
{
"pipeline": {
"build": {
"dependsOn": [
"^build",
"$GATSBY_MEDUSA_BACKEND_URL"
],
"outputs": ["public/**"]
},
"lint": {
"outputs": []
},
"dev": {
"cache": false
}
}
}
Same issue with 1.2.5, it only happens on the CI.
I've downgraded to 1.2.3 and it fixes the issue, so this seems to be a regression introduced in 1.2.4.
Yes, having the same issue on my Mac
From one day to the next i had the same Issue in 1.1.6 without changing something -> upgraded to 1.2.3 but it remains.
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /store/package.json, /store/package-lock.json: git hash-object exited with status: exec: "git": executable file not found in $PATH
edit:
So i found out, that when i install git on the docker image in creating it works now.
RUN apk add git
Same here when I try to run npm run build
on docker
I downgraded to version 1.2.3 and it's working.
This the error I am getting when running pnpm run lint
which has the following script definition turbo run lint --cache-dir=.turbo-cache --no-deps
when using turbo 1.2.6-canary.0
.
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /Users/xxx/Development/Projects/monorepo-playground/package.json, /Users/xxx/Development/Projects/monorepo-playground/pnpm-lock.yaml: passed 2 file paths to Git to hash, but received 3 hashes ELIFECYCLE Command failed with exit code 1.
Same here when I try to run npm run build on ci gitlab (with turborepo v1.2.6).
I downgraded to version v1.2.3 and it's working.
Can those who are experiencing the issue confirm their git
version?
We are using the docker node 16-alpine : https://hub.docker.com/_/node
This docker uses the alpine 3.15 : https://github.com/nodejs/docker-node/blob/4e0fff70002f51c2b121c9b231917abcb63d2b1a/16/alpine3.15/Dockerfile
And the git version should be 2.34.2-r0 https://pkgs.alpinelinux.org/packages?name=git&branch=v3.15
I wasn't able to reproduce with that git version, but if anyone wants to try with a build from #1195 we should get a better error message to help track this down.
Hi, I am having the same issue. I already tried running the command with latest v1.2.8 of Turborepo and still showing:
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /Users/mateovivas/Documents/Gymdoor/gymdoor-mono/package.json, /Users/mateovivas/Documents/Gymdoor/gymdoor-mono/package-lock.json: git hash-object exited with status: exit status 128 error Command failed with exit code 1.
I think the problem started after I deleted the node_modules folder and the package-lock.json file to change my package manager to yarn. However, I have already commited my changes in git and still showing the error. When deploying to Vercel I get the same error:
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /vercel/path0/package.json, /vercel/path0/package-lock.json: git hash-object exited with status: exit status 128 14:27:59.774 | Error: Command " cd ../.. && npx turbo run build --scope=web --include-dependencies --no-deps" exited with 1
My local setup is:
git version 2.30.1 (Apple Git-130) I am on a MacOS Monterey (v12.2)
I think that the commit with the better message is not in v1.2.8. How can we test it?
Error message on v1.2.8:
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files directory/package.json, directory/package-lock.json: passed 2 file paths to Git to hash, but received 3 hashes
Node: v16.14.0 Git: v2.35.1
We are using the docker node 16-alpine : https://hub.docker.com/_/node
This docker uses the alpine 3.15 : https://github.com/nodejs/docker-node/blob/4e0fff70002f51c2b121c9b231917abcb63d2b1a/16/alpine3.15/Dockerfile
And the git version should be 2.34.2-r0 https://pkgs.alpinelinux.org/packages?name=git&branch=v3.15
Hello @gsoltis,
Thanks for the better error message.
I tested with the new version of turborepo 1.2.11 and the issue is :
"git": executable file not found in $PATH.
😄
I'm using the node docker alpine git and git
isn't included.
Now, I install git
and it works.
Regards
Mathieu
Fixed for me in v1.2.9 Thanks @gsoltis 🚀
Still a problem for me in 1.2.16
. After using the quickstart instructions, I receive:
▶ npx turbo run test
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /Users/dpeck/foo/Box/package.json, /Users/dpeck/foo/Box/package-lock.json: git hash-object exited with status: exit status 128. Output:
cbe71e18f1dd4bbc985e879b1b9b1c342996d452
fatal: could not open '/Users/dpeck/foo/Box/package-lock.json' for reading: No such file or directory
Can confirm this is also an issue for me on 1.2.16 on a docker container. Tests run fine on my macbook, but fail in container.
This is an issue on my end. v1.2.3 works, but all the newer ones appear that they don't.
This happened after we started to use pnpm and once we deleted the package-lock.json file. Newer versions of turborepo ran dev command runs fine with pnpm when the package-lock.json is present from our npm remnants, but started to spit out this error when deleting the package-lock.json file. Works fine downgrading to v1.2.3, however.
I think the package-lock.json
issue might be separate from the git
issue.
@dep @sid9102 @Erns are you all trying to use npm
? Or pnpm
?
npm in my case
@sid9102 are you seeing the git
error or something related to package-lock.json
?
Apologies, it looks like this issue might have too much going on in it. We may need to split this up a bit if it turns out they aren't related.
Same problem when using pnpm with turborepo when running a turbo command (turbo run ...
) inside a Dockerfile.
what worked for me in jenkins pipeline was using [email protected] and using clean install rather than just install. hopefully this helps at least one super frustrated individual. wish i could give some sort of techy/cool explanation, but i'm just a noob and got lucky with 1 permutation out of probably 150
btw, using [email protected] with node@14 docker image
Same issue with turborepo 1.3.1 + yarn on node:16-alpine
docker image.
Everthing was working properly, until an hour ago when I restarted my containers:
ERROR failed to calculate global hash: error hashing files.
make sure that git has been initialized failed to read `git hash-object`:
exec: "git": executable file not found in $PATH
I have no clue what I could have done to trigger this.
I removed all my .turbo
& node_modules
folders, pruned my container, restarted the Docker daemon, still no luck.
Ended up creating a simple Dockerfile
as a workaround:
FROM node:16-alpine
RUN apk add git
and using it in my docker-compose.yml
:
services:
turbo:
# image: node:16-alpine # <-- this has been working all day (?!)
build:
context: ./docker/node
The error disappear if I remove
"globalDependencies": [
".eslintrc.js"
],
from my turbo.json
file.
Looks like this could be the issue (my .eslintrc.js
- and the whole folder - is mounted as a volume).
This would explain why I had no issue when building, since nothing is mounted at build time.
If confirmed, the issue probably needs to be reopen.
Confirmed this issue is also happening using [email protected]
. Specifically, it's the error about failing to compute the global hash. pnpm
didn't have this issue (it currently has other issues not fully installing all deps)
confirmed working after removing "globalDependencies": ["$GITHUB_TOKEN", "tsconfig.json", ".env.*"],
I am having a similar issue to @Erns -- I migrated my turbo/react app from npm to yarn, and upon deleting the package-lock.json, I get the same error message (when using latest version of turbo).
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to read git hash-object: exit status 128
Upon downgrading to 1.2.3, it works. Any update would be great!
@kellyndassler is git
available in the environment where you are running this?
just got the issue too as I am moving out stuff to a monorepo, does any body know of way to debug this?
the hash-object command in workin in the terminal
❯ git hash-object turbo.json
ee4e7578d58631700adcbcfc0052dfe0852f140e
UPDATE: Figured it it out, had a ".husky" config present in the repo under the "prepare" script present. Running 'yarn install' showed me the error.
UPDATE 2:
after more code moving, got myself back to failed to calculate global hash...
and not sure how to debug :-(
after upgrade from 1.2.3 to 1.4.6, it happens.
> turbo run start
WARNING cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repository in the root of your monorepo
ERROR failed to calculate global hash: error hashing files: could not hash file pnpm-lock.yaml.
open pnpm-lock.yaml: no such file or directory
ELIFECYCLE Command failed with exit code 1.
1.2.3 works fine.