Vercel提示:

Build Failed
statCache does not contain value for tags/\n (resolved to /vercel/path0/public/tags//n)

Build Logs 提示:

19:03:17.358  	Cloning github.com/imldy/my-hugo-blog (Branch: main, Commit: 717bf90)
19:03:18.102  	Cloning completed: 743.97ms
19:03:18.160  	Analyzing source code...
19:03:19.054  	Installing build runtime...
19:03:21.720  	Build runtime installed: 2.666s
19:03:24.641  	Build cache not provided
19:03:25.605  	Installing Hugo version 0.82.0
19:03:26.307  	Start building sites … 
19:03:26.548  	                   | EN   
19:03:26.548  	-------------------+------
19:03:26.548  	  Pages            | 180  
19:03:26.549  	  Paginator pages  |  10  
19:03:26.549  	  Non-page files   |   0  
19:03:26.549  	  Static files     |   5  
19:03:26.549  	  Processed images |   0  
19:03:26.549  	  Aliases          | 101  
19:03:26.549  	  Sitemaps         |   1  
19:03:26.549  	  Cleaned          |   0  
19:03:26.549  	Total in 263 ms
19:03:26.853  	AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: statCache does not contain value for tags/\n (resolved to /vercel/path0/public/tags//n)
19:03:26.853  	    at glob (/vercel/ca3b2ac053d43b3d/.build-utils/node_modules/@vercel/build-utils/dist/index.js:29118:25)
19:03:26.853  	    at Object.build (/vercel/ca3b2ac053d43b3d/.build-utils/.builder/node_modules/@vercelruntimes/static-build/dist/index.js:13992:26)
19:03:26.853  	    at buildStep (/var/task/webpack:/@zeit/api/scripts/build-container/src/utils/purpose-build.ts:163:1) {
19:03:26.853  	  generatedMessage: false,
19:03:26.854  	  code: 'ERR_ASSERTION',
19:03:26.854  	  actual: undefined,
19:03:26.854  	  expected: true,
19:03:26.854  	  operator: '=='
19:03:26.854  	}

设置Build Command无果、在Environment Variables设置Hugo版本无果、设置Node.js Version无果,重新建项目无果,最后发现是有名为\n的标签导致的。

再仔细研究,发现我有一篇文章的标签是这样写的:

tags:
  - \r
  - \n

在Hexo和Hugo中,本地生成后,URL为https://imldy.cn/tags/n/,还算正常,而Vercel可能是重新实现了一遍Hugo,导致与Hugo官方的有差异。

改为

tags:
  - "\r"
  - "\n"

正常Build。

中途还怀疑过可能是 Vercel 无法处理 submodule,事实是与 Git 的submodule并无关系。