Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Next.js won't load anymore

I have been able to get around and make next.js apps a lot as of late. However, something changed and I cannot seem to find a solution to my issue. I run npx create-next-app and it hits me with an error and only creates the package.json. It then shows me this error. Any insight would be appreciated.

npx create-next-app imageuploads3
Creating a new Next.js app in /Users/Jeremy!@#$%^%$#/Desktop/Code For Learning/imageuploads3.

Using yarn.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Installing dependencies:

  • react
  • react-dom
  • next

node:events:505
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:476: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:476:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: ‘ENOENT’,
syscall: ‘spawn yarn’,
path: ‘yarn’,
spawnargs: [
‘add’,
‘–exact’,
‘–cwd’,
‘/Users/jeremy!@#$^%$#/Desktop/Code For Learning/imageuploads3’,
‘react’,
‘react-dom’,
‘next’
]
}

Node.js v17.8.0

IIOS 12.3

npx create-react-app works just fine BTW.

>Solution :

It’s because Yarn isn’t enabled. You have two options:

  1. If you want to use NPM instead of Yarn, pass the --use-npm flag in:
$ npx create-next-app --use-npm myapp
  1. For Yarn, enable Corepack first:
$ corepack enable
$ npx create-next-app myapp
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading