将Next.js应用程序部署到Netlify时出现问题

mkh04yzy  于 2023-04-05  发布在  其他
关注(0)|答案(1)|浏览(190)

当我尝试部署时,我似乎不能让这个工作。我在构建日志中得到这个
“我怎么解决这个问题”8:40:55 PM:$npm运行构建版本8:40:55 PM:〉JT-porto@0. 1. 0 build 8:40:55 PM:〉next build 8:40:55 PM:警告-未找到构建缓存。请配置构建缓存以加快重建。阅读更多:https://nextjs.org/docs/messages/no-cache 8:40:55 PM:info-Linting and checking validity of types... 8:40:58 PM:信息-创建优化的生产构建... 8:41:00 PM:编译失败。8:41:00 PM:晚上8点41分:./pages/index.js 8:41:00 PM:未找到模块:无法解析“../public/figma1.png”下午8:41:00:https://nextjs.org/docs/messages/module-not-found晚上8:41:00:〉Build failed because of webpack errors 8:41:00 PM: 8:41:00 PM:"build. command"失败
8:41:00 PM:─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ 8:41:00 PM:错误消息8:41:00 PM:命令失败,退出代码为1:npm run build(https://ntl.fyi/exit-code-1)8:41:00 PM: 8:41:00 PM:错误位置8:41:00 PM:在Netlify应用程序的构建命令中:晚上8点41分:npm run build 8:41:00 PM: 8:41:00 PM:已解决配置8:41:00 PM:构建:8:41:00 PM:command:npm run build 8:41:00 PM:命令来源:ui 8:41:00 PM:环境:晚上8点41分:- NEXT_PRIVATE_TARGET 8:41:00 PM:publish:/opt/build/repo/. next 8:41:00 PM:发布来源:ui 8:41:00 PM:插件:8:41:00 PM:- 输入:{} 8:41:00 PM:origin:ui 8:41:00 PM:package:'@netlify/plugin-nextjs '8:41:00 PM:缓存工件8:41:00 PM:开始保存节点模块8:41:00 PM:已完成保存节点模块8:41:00 PM:开始保存构建插件8:41:00 PM:完成保存构建插件8:41:00 PM:开始保存corepack缓存8:41:00 PM:已完成保存corepack缓存8:41:00 PM:开始保存pip缓存8:41:00 PM:已完成保存pip缓存8:41:00 PM:开始保存emacs cask依赖项8:41:00 PM:已完成emacs cask dependencies的保存8:41:02 PM:在"构建站点"阶段失败:生成脚本返回了非零退出代码:2(https://ntl.fyi/exit-code-2)8:41:00 PM:已开始保存maven依赖项8:41:00 PM:已完成保存maven依赖项8:41:00 PM:已开始保存启动依赖项8:41:00 PM:已完成保存启动依赖项8:41:00 PM:开始保存rust rustup缓存8:41:00 PM:完成保存rust rustup缓存8:41:00 PM:开始保存go依赖项8:41:00 PM:完成保存go依赖项8:41:02 PM:由于用户错误,生成失败:生成脚本返回了非零退出代码:2 8:41:02 PM:构建失败:无法构建站点8:41:02 PM:已在39.698秒内完成处理生成请求""
看起来PNG在正确的文件路径中。而且当我尝试npm运行build时。我没有获得手动部署的build文件夹。
Github https://github.com/joakimtin/reactporto

mfuanj7w

mfuanj7w1#

看起来这是一个文件命名问题。在公共目录中,将文件扩展名更改为.png而不是.PNG

相关问题