[部署问题排查]部署提示:Command "npm run build" exited with 1
描述bug 简单说明bug的现象、相关的错误提示、日志等
部署vercel提示如下错误:
[09:23:24.451] Running build in Washington, D.C., USA (East) – iad1 (Hive)
[09:23:24.558] Cloning github.com/banpie/NotionNext (Branch: main, Commit: 8e01d07)
[09:23:24.567] Skipping build cache, deployment was triggered without cache.
[09:23:25.018] Cloning completed: 460.522ms
[09:23:25.334] Running "vercel build"
[09:23:26.004] Vercel CLI 32.3.1
[09:23:26.542] Installing dependencies...
[09:23:27.735] npm WARN ERESOLVE overriding peer dependency
[09:23:27.736] npm WARN While resolving: [email protected]
[09:23:27.737] npm WARN Found: [email protected]
[09:23:27.737] npm WARN node_modules/react
[09:23:27.737] npm WARN react@"^18.2.0" from the root project
[09:23:27.737] npm WARN 17 more (@giscus/react, @headlessui/react, ...)
[09:23:27.737] npm WARN
[09:23:27.737] npm WARN Could not resolve dependency:
[09:23:27.737] npm WARN peer react@"^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
[09:23:27.737] npm WARN node_modules/react-intersection-observer
[09:23:27.737] npm WARN react-intersection-observer@"^6.1.0" from [email protected]
[09:23:27.737] npm WARN node_modules/react-lazy-images
[09:23:27.737] npm WARN
[09:23:27.737] npm WARN Conflicting peer dependency: [email protected]
[09:23:27.738] npm WARN node_modules/react
[09:23:27.738] npm WARN peer react@"^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
[09:23:27.738] npm WARN node_modules/react-intersection-observer
[09:23:27.738] npm WARN react-intersection-observer@"^6.1.0" from [email protected]
[09:23:27.738] npm WARN node_modules/react-lazy-images
[09:23:27.824] npm WARN ERESOLVE overriding peer dependency
[09:23:27.825] npm WARN While resolving: [email protected]
[09:23:27.825] npm WARN Found: [email protected]
[09:23:27.825] npm WARN node_modules/react
[09:23:27.825] npm WARN react@"^18.2.0" from the root project
[09:23:27.825] npm WARN 17 more (@giscus/react, @headlessui/react, ...)
[09:23:27.825] npm WARN
[09:23:27.825] npm WARN Could not resolve dependency:
[09:23:27.825] npm WARN peer react@"^15 || ^16" from [email protected]
[09:23:27.825] npm WARN node_modules/react-lazy-images
[09:23:27.825] npm WARN react-lazy-images@"^1.1.0" from [email protected]
[09:23:27.825] npm WARN node_modules/react-notion-x
[09:23:27.825] npm WARN
[09:23:27.826] npm WARN Conflicting peer dependency: [email protected]
[09:23:27.826] npm WARN node_modules/react
[09:23:27.826] npm WARN peer react@"^15 || ^16" from [email protected]
[09:23:27.826] npm WARN node_modules/react-lazy-images
[09:23:27.826] npm WARN react-lazy-images@"^1.1.0" from [email protected]
[09:23:27.826] npm WARN node_modules/react-notion-x
[09:23:27.828] npm WARN ERESOLVE overriding peer dependency
[09:23:27.828] npm WARN While resolving: [email protected]
[09:23:27.828] npm WARN Found: [email protected]
[09:23:27.828] npm WARN node_modules/react-dom
[09:23:27.828] npm WARN react-dom@"^18.2.0" from the root project
[09:23:27.828] npm WARN 10 more (@giscus/react, @headlessui/react, nano-css, next, ...)
[09:23:27.828] npm WARN
[09:23:27.828] npm WARN Could not resolve dependency:
[09:23:27.828] npm WARN peer react-dom@"^15 || ^16" from [email protected]
[09:23:27.829] npm WARN node_modules/react-lazy-images
[09:23:27.829] npm WARN react-lazy-images@"^1.1.0" from [email protected]
[09:23:27.829] npm WARN node_modules/react-notion-x
[09:23:27.829] npm WARN
[09:23:27.829] npm WARN Conflicting peer dependency: [email protected]
[09:23:27.829] npm WARN node_modules/react-dom
[09:23:27.829] npm WARN peer react-dom@"^15 || ^16" from [email protected]
[09:23:27.829] npm WARN node_modules/react-lazy-images
[09:23:27.829] npm WARN react-lazy-images@"^1.1.0" from [email protected]
[09:23:27.829] npm WARN node_modules/react-notion-x
[09:23:27.848] npm WARN ERESOLVE overriding peer dependency
[09:23:27.848] npm WARN While resolving: [email protected]
[09:23:27.848] npm WARN Found: [email protected]
[09:23:27.848] npm WARN node_modules/react
[09:23:27.849] npm WARN react@"^18.2.0" from the root project
[09:23:27.849] npm WARN 17 more (@giscus/react, @headlessui/react, ...)
[09:23:27.849] npm WARN
[09:23:27.849] npm WARN Could not resolve dependency:
[09:23:27.849] npm WARN peer react@"15.x || 16.x" from [email protected]
[09:23:27.849] npm WARN node_modules/react-spinner-children
[09:23:27.849] npm WARN react-spinner-children@"^1.0.8" from [email protected]
[09:23:27.849] npm WARN node_modules/react-facebook
[09:23:27.849] npm WARN
[09:23:27.849] npm WARN Conflicting peer dependency: [email protected]
[09:23:27.849] npm WARN node_modules/react
[09:23:27.849] npm WARN peer react@"15.x || 16.x" from [email protected]
[09:23:27.849] npm WARN node_modules/react-spinner-children
[09:23:27.849] npm WARN react-spinner-children@"^1.0.8" from [email protected]
[09:23:27.849] npm WARN node_modules/react-facebook
[09:23:41.199]
[09:23:41.200] added 730 packages in 14s
[09:23:41.200]
[09:23:41.200] 175 packages are looking for funding
[09:23:41.200] run `npm fund` for details
[09:23:41.229] Detected Next.js version: 13.3.1
[09:23:41.234] Detected `package-lock.json` generated by npm 7+
[09:23:41.234] Running "npm run build"
[09:23:41.681]
[09:23:41.681] > [email protected] build
[09:23:41.681] > next build
[09:23:41.681]
[09:23:41.958] info - Loaded env from /vercel/path0/.env.local
[09:23:42.097] warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
[09:23:42.097] warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
[09:23:42.097]
[09:23:42.117] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[09:23:42.117] This information is used to shape Next.js' roadmap and prioritize features.
[09:23:42.117] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[09:23:42.117] https://nextjs.org/telemetry
[09:23:42.117]
[09:23:42.271] info - Linting and checking validity of types...
[09:23:45.999] info - Creating an optimized production build...
[09:24:11.184] info - Compiled successfully
[09:24:11.193] info - Collecting page data...
[09:24:12.329] [请求API] from:slug-paths id:f130c0e18a3245b2963e043b014a577d
[09:24:12.334] [请求API] from:category-paths id:f130c0e18a3245b2963e043b014a577d
[09:24:12.374] [请求API] from:slug-paths id:f130c0e18a3245b2963e043b014a577d
[09:24:12.382] [请求API] from:category-paths id:f130c0e18a3245b2963e043b014a577d
[09:24:13.048] [响应成功]: from:category-paths
[09:24:13.048] [API耗时] 666ms
[09:24:13.063] TypeError: Cannot convert undefined or null to object
[09:24:13.063] at getPageProperties (/vercel/path0/.next/server/chunks/3151.js:798:25)
[09:24:13.063] at getDataBaseInfoByNotionAPI (/vercel/path0/.next/server/chunks/3151.js:679:105)
[09:24:13.063] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[09:24:13.063] at async getNotionPageData (/vercel/path0/.next/server/chunks/3151.js:461:16)
[09:24:13.063] at async getGlobalData (/vercel/path0/.next/server/chunks/3151.js:418:18)
[09:24:13.063] at async getStaticPaths (/vercel/path0/.next/server/pages/category/[category]/page/[page].js:87:45)
[09:24:13.063] at async buildStaticPaths (/vercel/path0/node_modules/next/dist/build/utils.js:673:33)
[09:24:13.063] at async /vercel/path0/node_modules/next/dist/build/utils.js:1099:113
[09:24:13.063] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:97:20)
[09:24:13.065]
[09:24:13.066] > Build error occurred
[09:24:13.068] Error: Failed to collect page data for /category/[category]/page/[page]
[09:24:13.068] at /vercel/path0/node_modules/next/dist/build/utils.js:1130:15
[09:24:13.068] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[09:24:13.069] type: 'Error'
[09:24:13.069] }
[09:24:13.142] Error: Command "npm run build" exited with 1
复现步骤 出现这个bug的操作步骤
我是讲Wordpress的文档导出为Markdown格式,导入notion,然后将notion 的文档迁移到database,然后在database写入了slug,然后部署提示如下错误。
但是如果删除自己的文章,保留默认文章,又提示可以成功部署。
期望的正常结果 希望按这个步骤,正常操作结果是什么
截图 相关的页面,应该的结果
环境
- 操作系统: MACOS
- 浏览器:Chrome
- NotionNext版本: 4.0.15
- 主题 [例如. hexo]:heo
这个应该是你导入的文章,在设置文章的基础属性的时候出错了。
这个应该是你导入的文章,在设置文章的基础属性的时候出错了。
感谢,但是我是先拖动文章,然后人工设置标签、slug、日期的,而且我尝试把日期、slug都删除也不行。分类是空的。
您能发个文章的链接,或者您notion的链接吗?这样可以帮您看一下。
你是wp直接导出md吗? 为了方便迁移个人推荐md格式支持多端平台 wp→xml→md→notion→notionnext 别看步骤多,也就五分钟搞定
你的情况需要几篇文章样本,个人猜测是文章可能有些字符不兼容
我在群里看到有人和你一样的bug。我复现之后,给他的回复:
这个bug是日期和文章中的代码块导致的。我复制了你的数据库,然后本地生成了一下。第一次提示是日期错误,即使把所有的文章都设置成Draft草稿,仍然无法渲染。所以需要将数据库的日期列表删除,然后创建一个新的日期列表。这样就可以正常渲染出主页。 之后我尝试发布一些文章,依然报错。但是这次报错的内容是渲染引擎将代码块识别成了第三方。解决办法就是在notion的界面中通过“/code”重新生成代码块。解决这两个问题,就正常了。
感谢各位的帮助,我测试了发现,我是批量从Excel中复制workpress的日期格式,例如2023/10/02,复制到notion的数据表,一旦这么操作就会出现这个bug。所以最后的办法,就是把200多篇文章,人工设置日期就好了。
你是wp直接导出md吗? 为了方便迁移个人推荐md格式支持多端平台 wp→xml→md→notion→notionnext 别看步骤多,也就五分钟搞定
你的情况需要几篇文章样本,个人猜测是文章可能有些字符不兼容 是的,我是python把XML转HTML导入notion,如果是MD的话,导入外链图片notion识别不出来。
我在群里看到有人和你一样的bug。我复现之后,给他的回复:
这个bug是日期和文章中的代码块导致的。我复制了你的数据库,然后本地生成了一下。第一次提示是日期错误,即使把所有的文章都设置成Draft草稿,仍然无法渲染。所以需要将数据库的日期列表删除,然后创建一个新的日期列表。这样就可以正常渲染出主页。 之后我尝试发布一些文章,依然报错。但是这次报错的内容是渲染引擎将代码块识别成了第三方。解决办法就是在notion的界面中通过“/code”重新生成代码块。解决这两个问题,就正常了。
对的,我最后也是把日期删除了,人工设置,可能系统不支持复制黏贴日期。