Next.js create-next-app 将不再有效

Next.js create-next-app won't work anymore

我最近已经能够四处走动并制作 Next.js 应用程序了。然而,事情发生了变化,我似乎无法找到解决我的问题的方法。我 运行 npx create-next-app <app name> 它给我带来了一个错误,只创建了 package.json。然后它向我显示此错误。任何见解将不胜感激。

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

Using yarn.

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 顺便说一句,工作正常。

这是因为未启用 Yarn。您有两个选择:

  1. 如果您想使用 NPM 而不是 Yarn,请将 --use-npm 标志传递到:
$ npx create-next-app --use-npm myapp
  1. 对于纱线,enable Corepack first
$ corepack enable
$ npx create-next-app myapp