Blo*_*gic 6 node.js typescript reactjs gatsby
gatsby build我的 gatsby 项目工作正常,并且也有 404 页面,但是我在成功完成构建过程后或在成功完成构建过程后打开浏览器时收到错误:
Building static HTML for pageserror: Error: ENOENT: no such file or directory
Run Code Online (Sandbox Code Playgroud)
如果我在这段时间内没有收到错误,gatsby build那么我必须在运行时进入浏览器gatsby serve并打开浏览器:
Error: ENOENT: no such file or directory, stat '/project/public/404.html'
Run Code Online (Sandbox Code Playgroud)
// clean gatsby cache
gatsby clean
// delete node modules, cache and public folder.
rm -rf node_module .cache public
// reinstall node modules
npm install
// run gatsby in develop mode
gatsby develop
// build the gatsby project
npm run build
// serve the building project.
gatsby serve
Run Code Online (Sandbox Code Playgroud)
如果不这样做,请在文件夹内添加404.js或404.tsx归档pages
build .cache、 和node_modules。yarn add pkg.json npm install *gatsby develop之前的gatsby buildReact.lazy suspense可能您在不支持服务器端渲染的组件中使用,您需要通过任何可能的方式删除它。然后试试这个应该可行!
| 归档时间: |
|
| 查看次数: |
6432 次 |
| 最近记录: |