Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Creating Payload App Fails on Windows 11 #3201

Closed
kave-me opened this issue Aug 21, 2023 · 3 comments
Closed

Creating Payload App Fails on Windows 11 #3201

kave-me opened this issue Aug 21, 2023 · 3 comments
Assignees
Labels
status: cant-reproduce If an issue cannot be reproduced

Comments

@kave-me
Copy link

kave-me commented Aug 21, 2023

Link to reproduction

.

To Reproduce

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

Describe the Bug

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.

Expected Behavior

The npx create-payload-app command should execute without errors and generate the desired boilerplate application as expected on Windows 11.

Payload Version

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.

@kave-me kave-me added the status: needs-triage Possible bug which hasn't been reproduced yet label Aug 21, 2023
@kave-me kave-me changed the title npx create-payload-app failed to finish init in Windows 11 Creating Payload App Fails on Windows 11 Aug 21, 2023
@DanRibbens
Copy link
Contributor

I was able to run this without an issue.

image

Can you try again to rule out that whatever it was hasn't been fixed from a change in one of the dependencies?

If you still have trouble, what else can you tell me about your environment? Maybe it has to do with the version of Node or NPM?

Thanks!

@DanRibbens DanRibbens added the status: cant-reproduce If an issue cannot be reproduced label Aug 21, 2023
@AlessioGr AlessioGr removed the status: needs-triage Possible bug which hasn't been reproduced yet label Aug 21, 2023
@kave-me
Copy link
Author

kave-me commented Aug 22, 2023

npm cache clean --force
PS C:\Users\kavem> npm cache clean --force
npm WARN using --force Recommended protections disabled.
npx create-payload-app
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'
}
Trying `0.3.34`
PS C:\Users\kavem\work> npx [email protected]
Need to install the following packages:
[email protected]
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
Trying `npx create-react-app` as well, it fails too! PS C:\Users\kavem\work> npx create-react-app r1 Need to install the following packages: [email protected] Ok to proceed? (y) y npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

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!

I cant run `git` in powershell, as it's directory is not in `PATH`, I added `C:\Program Files\Git\cmd` to `PATH`.
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
After fixing `PATH`, `create-react-app` work.

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!

Now `create-payload-app` works too.

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

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! 🫰

@MarkAtOmniux
Copy link
Contributor

MarkAtOmniux commented Aug 22, 2023

Could be a cache issue, does this help at all?

saltnpixels/ignition#24

@payloadcms payloadcms locked and limited conversation to collaborators Aug 22, 2023
@DanRibbens DanRibbens converted this issue into discussion #3212 Aug 22, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
status: cant-reproduce If an issue cannot be reproduced
Projects
None yet
Development

No branches or pull requests

4 participants