Create-React-App 部署(github 和 vercel)和错误

问题描述 投票:0回答:0

我是全栈工程的初学者,目前正在处理由 create-react-app 制作的我的作品集。我现在进入生产阶段,正在尝试部署。不幸的是,github 上的页面显示空白页面链接。下一步是 Vercel,由于错误,它甚至没有通过构建阶段:

[17:59:47.258] Running build in San Francisco, USA (West) – sfo1
[17:59:47.314] Cloning github.com/dusanw/my-portfolio (Branch: main, Commit: 640e362)
[17:59:47.448] Previous build cache not available
[17:59:48.290] Cloning completed: 975.89ms
[17:59:48.422] Running "vercel build"
[17:59:48.851] Vercel CLI 28.16.6
[17:59:49.434] Installing dependencies...
[17:59:51.137] npm ERR! code ERESOLVE
[17:59:51.141] npm ERR! ERESOLVE could not resolve
[17:59:51.141] npm ERR! 
[17:59:51.141] npm ERR! While resolving: @material-ui/[email protected]
[17:59:51.141] npm ERR! Found: [email protected]
[17:59:51.141] npm ERR! node_modules/react
[17:59:51.141] npm ERR!   react@"^18.0.0" from the root project
[17:59:51.141] npm ERR!   peer react@">=0.14.0" from @hypnosphi/[email protected]
[17:59:51.142] npm ERR!   node_modules/@hypnosphi/create-react-context
[17:59:51.142] npm ERR!     @hypnosphi/create-react-context@"^0.3.1" from [email protected]
[17:59:51.142] npm ERR!     node_modules/react-popper
[17:59:51.142] npm ERR!       react-popper@"^1.3.6" from [email protected]
[17:59:51.142] npm ERR!       node_modules/reactstrap
[17:59:51.142] npm ERR!         reactstrap@"^8.9.0" from the root project
[17:59:51.142] npm ERR!   21 more (@restart/context, @restart/hooks, ...)
[17:59:51.142] npm ERR! 
[17:59:51.142] npm ERR! Could not resolve dependency:
[17:59:51.142] npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected]
[17:59:51.142] npm ERR! node_modules/@material-ui/core
[17:59:51.142] npm ERR!   @material-ui/core@"^4.12.3" from the root project
[17:59:51.143] npm ERR!   peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]
[17:59:51.143] npm ERR!   node_modules/@material-ui/icons
[17:59:51.143] npm ERR!     @material-ui/icons@"^4.11.2" from the root project
[17:59:51.143] npm ERR! 
[17:59:51.143] npm ERR! Conflicting peer dependency: [email protected]
[17:59:51.143] npm ERR! node_modules/react
[17:59:51.143] npm ERR!   peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected]
[17:59:51.143] npm ERR!   node_modules/@material-ui/core
[17:59:51.143] npm ERR!     @material-ui/core@"^4.12.3" from the root project
[17:59:51.143] npm ERR!     peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]
[17:59:51.143] npm ERR!     node_modules/@material-ui/icons
[17:59:51.143] npm ERR!       @material-ui/icons@"^4.11.2" from the root project
[17:59:51.143] npm ERR! 
[17:59:51.144] npm ERR! Fix the upstream dependency conflict, or retry
[17:59:51.144] npm ERR! this command with --force, or --legacy-peer-deps
[17:59:51.144] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
[17:59:51.144] npm ERR! 
[17:59:51.144] npm ERR! See /vercel/.npm/eresolve-report.txt for a full report.
[17:59:51.144] 
[17:59:51.144] npm ERR! A complete log of this run can be found in:
[17:59:51.144] npm ERR!     /vercel/.npm/_logs/2023-02-24T16_59_49_706Z-debug-0.log
[17:59:51.163] Error: Command "npm install" exited with 1
[17:59:51.251] 

我确实尝试在 vercel 中将构建命令更改为 npm install 或

CI=' ' false
。我读到有关将 CI 设置为 false 的信息,但我不知道在哪里设置它,因为我在环境变量中尝试过,但它没有让我这样做。我知道有很多类似的帖子,但到目前为止还没有适合我的解决方案。我尝试使用 npm install --legacy-peer-deps 运行,它实际上构建并部署了它,但得到了相同的空白结果链接到 vercel

我在这方面很新,但我在各种论坛和问题上研究了两天,但也没有帮助。我恳请你的帮助。我确实在本地工作(部署),没有任何问题。我只是想让它出版。分别我想把我的托管,我不知道如何。感谢您的时间和帮助。

链接到 github 仓库

链接到vercel

deployment create-react-app github-pages vercel
© www.soinside.com 2019 - 2024. All rights reserved.