question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`npx create-next-app@latest` not working

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

15reactions
yeskunallcommented, Mar 27, 2022

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: https://github.com/vercel/next.js/pull/34947#discussion_r820032044

9reactions
TaylorFlynncommented, Mar 26, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create-next-app: command not found error [Solved] | bobbyhadz
Use `npx` to solve the error create-next-app: command not found, e.g. `npx create-next-app@latest` or install the package globally by running `npm install ...
Read more >
next.js - "command not found: create-next-app" how do I ...
Create a new folder and name it as you like,then open your terminal & go into the project folder and run the step...
Read more >
Create Next App | Next.js
Interactive Experience: Running npx create-next-app@latest (with no arguments) launches an interactive experience that guides you through setting up a project.
Read more >
How to install Next.js globally help of create-next-app? - Medium
npx create -next-app@latest --typescript ... The second method is not a very common way to install next.js. in this method, you install nextjs,...
Read more >
Home | Create React App – Set up a Next.js app by running ...
Set up a Next.js app by running one command.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found