.
I am utilizing Windows 11 as my operating system. Upon executing the command npx create-payload-app
, I encountered an error. It is important to note that my C Drive is formatted as NTFS
.
PS C:\Users\kavem\work> npx create-payload-app
Welcome to Payload. Let's create a project!
√ Project name? ... p1
√ Choose project template » website
√ Enter MongoDB connection ... mongodb://localhost:32768/p1
Creating project in C:\Users\kavem\work\p1
DegitError: could not find commit hash for HEAD
at Degit._cloneWithTar (C:\Users\kavem\AppData\Local\npm-cache\_npx\2238e51406dcebe9\node_modules\degit\dist\index-688c5d50.js:14258:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Degit.clone (C:\Users\kavem\AppData\Local\npm-cache\_npx\2238e51406dcebe9\node_modules\degit\dist\index-688c5d50.js:14096:4) {
code: 'MISSING_REF',
ref: 'HEAD'
}
PS C:\Users\kavem\work> npx create-payload-app^C
PS C:\Users\kavem\work> remove-Item -Recurse -Force .\p1
During the process of executing the npx
script to create a boilerplate application using Payload on Windows 11, I encountered a failure. The error message provided above details the issue I encountered. Notably, my C Drive utilizes the NTFS
filesystem.
The npx create-payload-app
command should execute without errors and generate the desired boilerplate application as expected on Windows 11.
1.14.0
Thank you for your attention to this matter, and I appreciate your support in resolving this issue. If you require any further information or assistance, please do not hesitate to reach out.
PS C:\Users\kavem> npm cache clean --force
npm WARN using --force Recommended protections disabled.
PS C:\Users\kavem\work> npx create-payload-app
Welcome to Payload. Let's create a project!
√ Project name? ... p2
√ Choose project template » website
√ Enter MongoDB connection ... mongodb://localhost:32769/p1
Creating project in C:\Users\kavem\work\p2
DegitError: could not find commit hash for HEAD
at Degit._cloneWithTar (C:\Users\kavem\AppData\Local\npm-cache\_npx\2238e51406dcebe9\node_modules\degit\dist\index-688c5d50.js:14258:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Degit.clone (C:\Users\kavem\AppData\Local\npm-cache\_npx\2238e51406dcebe9\node_modules\degit\dist\index-688c5d50.js:14096:4) {
code: 'MISSING_REF',
ref: 'HEAD'
}
PS C:\Users\kavem\work> npx create-payload-app@0.3.34
Need to install the following packages:
create-payload-app@0.3.34
Ok to proceed? (y) y
Welcome to Payload. Let's create a project!
√ Project name? p3
√ Choose project template » payload-website
√ Enter MongoDB connection mongodb://localhost:32769/p1
Creating project in C:\Users\kavem\work\p3
DegitError: could not find commit hash for HEAD
Creating a new React app in C:\Users\kavem\work\r1.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1439 packages in 2m
241 packages are looking for funding
run npm fund
for details
Git repo not initialized Error: Command failed: git --version
at checkExecSyncError (node:child_process:885:11)
at execSync (node:child_process:957:15)
at tryGitInit (C:\Users\kavem\work\r1\node_modules\react-scripts\scripts\init.js:46:5)
at module.exports (C:\Users\kavem\work\r1\node_modules\react-scripts\scripts\init.js:276:7)
at [eval]:3:14
at Script.runInThisContext (node:vm:123:12)
at Object.runInThisContext (node:vm:299:38)
at node:internal/process/execution:79:19
at [eval]-wrapper:6:22 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 52548,
stdout: null,
stderr: null
}
Installing template dependencies using npm...
added 69 packages, and changed 1 package in 15s
245 packages are looking for funding
run npm fund
for details
Removing template package using npm...
removed 1 package, and audited 1508 packages in 3s
245 packages are looking for funding
run npm fund
for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Success! Created r1 at C:\Users\kavem\work\r1
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd r1
npm start
Happy hacking!
PS C:\Users\kavem\work> git --version
git: The term 'git' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
## After Adding it
PS C:\Users\kavem\work> git --version
git version 2.41.0.windows.3
PS C:\Users\kavem\work> npx create-react-app r2
Creating a new React app in C:\Users\kavem\work\r2.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1439 packages in 53s
241 packages are looking for funding
run npm fund
for details
Initialized a git repository.
Installing template dependencies using npm...
added 69 packages, and changed 1 package in 6s
245 packages are looking for funding
run npm fund
for details
Removing template package using npm...
removed 1 package, and audited 1508 packages in 3s
245 packages are looking for funding
run npm fund
for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Created git commit.
Success! Created r2 at C:\Users\kavem\work\r2
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
PS C:\Users\kavem\work> npx create-payload-app p5
Welcome to Payload. Let's create a project!
√ Choose project template » website
√ Enter MongoDB connection ... mongodb://localhost:32769/p1
Creating project in C:\Users\kavem\work\p5
√ Dependencies installed
√ .env file created
√ Payload project successfully created
Launch Application:
Documentation:
In summary, the issue was related to Git not being recognized due to the PATH environment variable. Once the PATH was corrected, the issues were resolved, and creating the Payload app was successful. ✅
Please let me know if you need any further assistance or clarification! 🫰
Could be a cache issue, does this help at all?
I've converted this to a discussion so it can be found by others having the same problem.
In summary if you are running create-payload-app and get the error:
DegitError: could not find commit hash for HEAD
Make sure that git's cmd is included in your PATH.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.