我正在尝试将我的NextJS站点部署到Vercel。
我收到了下面这些我似乎无法解决的错误。
下面是构建日志:
任何帮助都是非常受欢迎的。提前谢谢你。
[17:30:42.222] Cloning github.com/MoikeCheck/portfolio (Branch: main, Commit: 3f5806a)
[17:30:42.835] Cloning completed: 611.953ms
[17:30:43.283] Installing build runtime...
[17:30:46.702] Build runtime installed: 3.419s
[17:30:48.243] Looking up build cache...
[17:30:52.069] Build cache downloaded [51.60 MB]: 3402.218ms
[17:30:52.360] Installing dependencies...
[17:30:52.683] yarn install v1.22.17
[17:30:52.778] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[17:30:52.785] [1/4] Resolving packages...
[17:30:53.545] [2/4] Fetching packages...
[17:31:16.236] [3/4] Linking dependencies...
[17:31:16.237] warning " > @chakra-ui/icons@1.1.7" has unmet peer dependency "@chakra-ui/system@>=1.0.0".
[17:31:16.238] warning "@chakra-ui/icons > @chakra-ui/icon@2.0.5" has unmet peer dependency "@chakra-ui/system@>=1.0.0".
[17:31:16.248] warning "@chakra-ui/react > @chakra-ui/modal > react-remove-scroll@2.4.1" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
[17:31:16.248] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert@0.13.2" has incorrect peer dependency "react@^16.8.0 || 17.x".
[17:31:16.249] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert@0.13.2" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
[17:31:16.249] warning "@chakra-ui/react > @chakra-ui/modal > @chakra-ui/focus-lock > react-focus-lock@2.5.2" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
[17:31:16.250] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert > @reach/utils@0.13.2" has incorrect peer dependency "react@^16.8.0 || 17.x".
[17:31:16.250] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert > @reach/utils@0.13.2" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
[17:31:16.251] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert > @reach/visually-hidden@0.13.2" has incorrect peer dependency "react@^16.8.0 || 17.x".
[17:31:16.252] warning "@chakra-ui/react > @chakra-ui/toast > @reach/alert > @reach/visually-hidden@0.13.2" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
[17:31:16.252] warning "@chakra-ui/react > @chakra-ui/modal > @chakra-ui/focus-lock > react-focus-lock > react-clientside-effect@1.2.5" has incorrect peer dependency "react@^15.3.0 || ^16.0.0 || ^17.0.0".
[17:31:16.252] warning "@emotion/react > @emotion/babel-plugin@11.9.2" has unmet peer dependency "@babel/core@^7.0.0".
[17:31:16.252] warning "@emotion/react > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.16.7" has unmet peer dependency "@babel/core@^7.0.0-0".
[17:31:16.254] warning "react-pdf > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
[17:31:16.257] warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[17:31:21.993] [4/4] Building fresh packages...
[17:31:22.538] success Saved lockfile.
[17:31:22.545] Done in 29.87s.
[17:31:22.573] Detected Next.js version: 12.1.5
[17:31:22.578] Running "yarn run build"
[17:31:22.946] yarn run v1.22.17
[17:31:22.993] $ next build
[17:31:23.879] info - Checking validity of types...
[17:31:26.071]
[17:31:26.072] Failed to compile.
[17:31:26.072]
[17:31:26.072] ./pages/contacts.js
[17:31:26.072] 121:43 Error: Do not pass children as props. Instead, nest children between the opening and closing tags. react/no-children-prop
[17:31:26.073] 134:43 Error: Do not pass children as props. Instead, nest children between the opening and closing tags. react/no-children-prop
[17:31:26.073]
[17:31:26.073] info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
[17:31:26.091] error Command failed with exit code 1.
[17:31:26.091] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[17:31:26.104] Error: Command "yarn run build" exited with 1
发布于 2022-05-02 17:47:10
你的应用程序失败了。
在pages/contact.js
中,在第121行和第134行中,您可能有如下所示
<SomeComponent children={<div>...</div>} />
把它改成,
<SomeComponent><div>...</div></SomeComponent>
每
[17:31:26.072] ./pages/contacts.js
[17:31:26.072] 121:43 Error: Do not pass children as props. Instead, nest children between the opening and closing tags. react/no-children-prop
[17:31:26.073] 134:43 Error: Do not pass children as props. Instead, nest children between the opening and closing tags. react/no-children-prop
https://stackoverflow.com/questions/72089985
复制相似问题