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

npx create-next-app@latest not working #35623

Closed
1 task done
HarrisonHemstreet opened this issue Mar 26, 2022 · 12 comments
Closed
1 task done

npx create-next-app@latest not working #35623

HarrisonHemstreet opened this issue Mar 26, 2022 · 12 comments
Labels
bug Issue was opened via the bug report template.

Comments

@HarrisonHemstreet
Copy link

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

I did not check next@canary because I don't think believe that create-next-app would carry over
Because I'm not even able to make a project with create-next-app, here's what's happening:
When I run the npx create-next-app@latest command in the terminal, I get this error:

~ on ☁️   
❯ npx create-next-app
Need to install the following packages:
  create-next-app
Ok to proceed? (y) y
✔ What is your project named? … test2
Creating a new Next.js app in /home/harry/test2.

Using yarn.

Installing dependencies:
- react
- react-dom
- next

node:events:498
      throw er; // Unhandled 'error' event
      ^

Error: spawn yarn ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn yarn',
  path: 'yarn',
  spawnargs: [
    'add',
    '--exact',
    '--cwd',
    '/home/harry/test2',
    'react',
    'react-dom',
    'next'
  ]
}

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

create-next-app is not working. The command only produces a directory and a package.json file. That's it.

Expected Behavior

I want create-next-app to build me a next.js project

To Reproduce

run create-next-app@latest in your terminal

@HarrisonHemstreet HarrisonHemstreet added the bug Issue was opened via the bug report template. label Mar 26, 2022
@TaylorFlynn
Copy link

I am experiencing the same issue,

I have never installed yarn yet it still is trying to install next template project via yarn instead of npm.

@yeskunall
Copy link
Contributor

Looks like this will be fixed in #35608. It hasn’t been made part of an official release yet, only merged into canary. I was able to bypass the error using the --use-npm flag.

TIL: Next.js now uses Yarn by default: #34947 (comment)

@abLyn
Copy link

abLyn commented Mar 27, 2022

I am experiencing the same issue,
I have never installed yarn yet it still is trying to install next template project via yarn instead of npm.

NEXTJS npx create-next-app@latest --ts fronten
Creating a new Next.js app in /home/chaffa/Desktop/NEXTJS/frontend.

Using yarn. <------------------------------------------------------------------------------------

Installing dependencies:

  • react
  • react-dom
  • next

@marko-knoebl
Copy link

Looks like this was introduced in the latest patch version release:

this will succeed:

npx create-next-app@12.1.0

this will fail:

npx create-next-app@12.1.1

@eg-delacruz
Copy link

I tried installing the previous version, as marko-knoebl suggested, but still got the issue.

I solved it by previously installing yarn: npm install --global yarn

Afterwards, you should be able to install version 12.1.1 with all the files needed.

@tombohub
Copy link

@yeskunall why are they doing that? If we use npx then it's obviously npm, not yarn. I dont understand

@khudaverdiev11
Copy link

use npx create-next-app nextapp --use-npm
it will work

@rcabre95
Copy link

use npx create-next-app nextapp --use-npm it will work

thank you for this @khudaverdiev11 . worked like a charm. also works with the --typescript flag

@balazsorban44
Copy link
Member

#35623 (comment) is correct, indeed #35608 fixes this. You can try it out on canary right now, we are going to release it to latest 🔜 Closing as this should already be fixed. 👍

@ijjk
Copy link
Member

ijjk commented Mar 28, 2022

Hi, this has been fixed in the latest version of Next.js v12.1.2 please give it a try! Note: this may require running with @latest e.g. npx create-next-app@latest.

@HarrisonHemstreet
Copy link
Author

Hi, this has been fixed in the latest version of Next.js v12.1.2 please give it a try! Note: this may require running with @latest e.g. npx create-next-app@latest.

It works! Thank you so much for your hard work!

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests