首页 > 解决方案 > nextjs 生产构建失败

问题描述

在为 nextjs 应用程序的生产构建运行 npm run build 时,我收到此错误

警告:您已选择退出自动静态优化,因为getInitialProps. pages/_app这不会选择退出页面getStaticProps 阅读更多:https ://err.sh/next.js/opt-out-auto-static-optimization

自动优化页面.. 预渲染页面“/404”时发生错误。阅读更多:https ://err.sh/next.js/prerender-error:TypeError:无法读取未定义的“加密”属性

预呈现页面“/”时发生错误。阅读更多:https ://err.sh/next.js/prerender-error:TypeError:无法读取未定义的“加密”属性

预呈现页面“/404.html”时发生错误。阅读更多:https ://err.sh/next.js/prerender-error:TypeError:无法读取未定义的“加密”属性

发生构建错误错误:导出在 _default (/home/osis/raj_server/mobile-web/node_modules/next/dist/export/index.js:19:1164) 在 processTicksAndRejections (internal/process/task_queues.js:97) 遇到错误:5) 在异步构建 (/home/osis/raj_server/mobile-web/node_modules/next/dist/build/index.js:36:218) 自动优化页面.npm ERR!代码 ELIFECYCLE npm 错误!errno 1 npm 错误!mobile-web@0.1.0 构建:next build npm 错误!退出状态 1 npm ERR!npm 错误!在 mobile-web@0.1.0 构建脚本中失败。npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!/home/osis/.npm/_logs/2020-06-12T12_20_18_063Z-debug.log

标签: reactjsnext.js

解决方案


推荐阅读