[英]what is the correct procedure to setup first nextjs app
I've been trying to create a Nextjs app
.我一直在尝试创建一个
Nextjs app
。 The command I've been using or which once worked npx create-next-app
throws:我一直在使用或曾经有效的命令
npx create-next-app
抛出:
Note: node -v 14.18.0注:node -v 14.18.0
Using yarn.
Installing dependencies:
- react
- react-dom
- next
'yarn' is not recognized as an internal or external command,
operable program or batch file.
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn yarn ENOENT
at notFoundError (C:\Users\Degamber\AppData\Roaming\npm\node_modules\create-next-
app\dist\index.js:100:3828)
at verifyENOENT (C:\Users\Degamber\AppData\Roaming\npm\node_modules\create-next-
app\dist\index.js:100:4207)
at ChildProcess.e.emit (C:\Users\Degamber\AppData\Roaming\npm\node_modules\create-next-
app\dist\index.js:100:4062)
at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.e.emit (C:\Users\Degamber\AppData\Roaming\npm\node_modules\create-next-
app\dist\index.js:100:4103)
at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn yarn',
path: 'yarn',
spawnargs: [
'add',
'--exact',
'--cwd',
'C:\\Users\\Degamber\\Downloads\\xyz\\nextjs-blog',
'react',
'react-dom',
'next'
]
}
PS C:\Users\Degamber\Downloads\xyz>
otherwise the document says use this: npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"
although it works but I want to make it setup easily using npx create-next-app
否则文档说使用这个:
npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"
虽然它有效,但我想使用npx create-next-app
轻松设置它
downgrade from the latest, install a prior version:从最新版本降级,安装以前的版本:
npx create-next-app@11.1.4 appname
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.