由于缺少 404 页面,Vercel 不会构建 Gatsby 站点
Vercel won't build Gatsby site because of missing 404 page
我正在开发托管在 Vercel 上的 Gatsby 网站。它 运行 在本地很好,但是当我将它推送到 Vercel 时,构建中断并显示错误消息 "error An unexpected error occurred: "https://registry.yarnpkg.com/@user/dom/-/dom-0.0.11.tgz: Request failed \"404 Not Found\"".
下面包含完整日志。
第一次遇到这个错误的时候,src/pages/404.js文件确实是少了。因此我创建了它,作为一个标准的功能组件,没有任何特殊功能。
当我 运行 开发版本 (localhost:8000/randomstring) 的 404 预览时,它显示正常。当我尝试在本地 gatsby build
构建它时,它成功了:
│ └ /something/
└ src/pages/404.js
├ /404/
└ /404.html
我试过创建新的 Vercel 项目,也是从不同的帐户,结果相同。我没有发现任何其他 post 包含此问题。
这是完整的构建日志:
[16:16:00.967] Retrieving list of deployment files...
[16:16:02.582] Downloading 60 deployment files...
[16:16:04.867] Installing build runtime...
[16:16:06.018] Build runtime installed: 1.151s
[16:16:06.063] Installing build runtime...
[16:16:08.203] Build runtime installed: 2.139s
[16:16:09.140] Looking up build cache...
[16:16:09.351] Looking up build cache...
[16:16:09.622] Build Cache not found
[16:16:09.848] Build Cache not found
[16:16:09.957] Detected package.json
[16:16:09.958] Installing dependencies...
[16:16:10.305] yarn install v1.22.17
[16:16:10.437] [1/4] Resolving packages...
[16:16:10.490] Installing dependencies...
[16:16:11.187] [2/4] Fetching packages...
[16:16:13.099] error An unexpected error occurred: "https://registry.yarnpkg.com/@myverceluser/dom/-/dom-0.0.11.tgz: Request failed \"404 Not Found\"".
[16:16:13.100] info If you think this is a bug, please open a bug report with the information provided in "/vercel/path2/yarn-error.log".
[16:16:13.100] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[16:16:47.226] Error: Command "yarn install" exited with 1
[16:16:47.441] yarn install v1.22.17
[16:16:47.552] [1/4] Resolving packages...
[16:16:48.313] [2/4] Fetching packages...
[16:16:48.946] error An unexpected error occurred: "https://registry.yarnpkg.com/@myverceluser/utils/-/utils-0.0.5.tgz: Request failed \"404 Not Found\"".
[16:16:48.946] info If you think this is a bug, please open a bug report with the information provided in "/vercel/path1/yarn-error.log".
[16:16:48.947] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[16:16:49.494] Error: Command "yarn install" exited with 1
如有任何见解,我们将不胜感激。如果我遗漏了一些重要信息,请告诉我,我会添加。
谢谢。
我认为不是你的404页面丢失了——框架没有提供默认值吗?
而是它无法获取此包,
% curl https://registry.yarnpkg.com/@user/dom/-/dom-0.0.11.tgz
{"error":"Not found"}
是这个https://yarnpkg.com/package/dom吗?那没有版本 0.0.11.
我正在开发托管在 Vercel 上的 Gatsby 网站。它 运行 在本地很好,但是当我将它推送到 Vercel 时,构建中断并显示错误消息 "error An unexpected error occurred: "https://registry.yarnpkg.com/@user/dom/-/dom-0.0.11.tgz: Request failed \"404 Not Found\"".
下面包含完整日志。
第一次遇到这个错误的时候,src/pages/404.js文件确实是少了。因此我创建了它,作为一个标准的功能组件,没有任何特殊功能。
当我 运行 开发版本 (localhost:8000/randomstring) 的 404 预览时,它显示正常。当我尝试在本地 gatsby build
构建它时,它成功了:
│ └ /something/
└ src/pages/404.js
├ /404/
└ /404.html
我试过创建新的 Vercel 项目,也是从不同的帐户,结果相同。我没有发现任何其他 post 包含此问题。
这是完整的构建日志:
[16:16:00.967] Retrieving list of deployment files...
[16:16:02.582] Downloading 60 deployment files...
[16:16:04.867] Installing build runtime...
[16:16:06.018] Build runtime installed: 1.151s
[16:16:06.063] Installing build runtime...
[16:16:08.203] Build runtime installed: 2.139s
[16:16:09.140] Looking up build cache...
[16:16:09.351] Looking up build cache...
[16:16:09.622] Build Cache not found
[16:16:09.848] Build Cache not found
[16:16:09.957] Detected package.json
[16:16:09.958] Installing dependencies...
[16:16:10.305] yarn install v1.22.17
[16:16:10.437] [1/4] Resolving packages...
[16:16:10.490] Installing dependencies...
[16:16:11.187] [2/4] Fetching packages...
[16:16:13.099] error An unexpected error occurred: "https://registry.yarnpkg.com/@myverceluser/dom/-/dom-0.0.11.tgz: Request failed \"404 Not Found\"".
[16:16:13.100] info If you think this is a bug, please open a bug report with the information provided in "/vercel/path2/yarn-error.log".
[16:16:13.100] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[16:16:47.226] Error: Command "yarn install" exited with 1
[16:16:47.441] yarn install v1.22.17
[16:16:47.552] [1/4] Resolving packages...
[16:16:48.313] [2/4] Fetching packages...
[16:16:48.946] error An unexpected error occurred: "https://registry.yarnpkg.com/@myverceluser/utils/-/utils-0.0.5.tgz: Request failed \"404 Not Found\"".
[16:16:48.946] info If you think this is a bug, please open a bug report with the information provided in "/vercel/path1/yarn-error.log".
[16:16:48.947] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[16:16:49.494] Error: Command "yarn install" exited with 1
如有任何见解,我们将不胜感激。如果我遗漏了一些重要信息,请告诉我,我会添加。
谢谢。
我认为不是你的404页面丢失了——框架没有提供默认值吗?
而是它无法获取此包,
% curl https://registry.yarnpkg.com/@user/dom/-/dom-0.0.11.tgz
{"error":"Not found"}
是这个https://yarnpkg.com/package/dom吗?那没有版本 0.0.11.