Gatsby 似乎没有建立在 Windows 子系统 Linux [Ubuntu] 上

Gatsby doesn't seem to build on Windows Subsystem Linux [Ubuntu]

注意:我在 Part 7 of the GatsbyJS tutorial 中遇到了这个问题(前面的部分工作正常)。

gatsby develop

...似乎触发了成功的构建,但该站点每次访问 http://localhost:8000/

时都会挂起

正在从 here 复制问题以提高可见性:

Gatsby doesn't seems to build on Windows Subsystem Linux due to EACCES issues. After running yarn start / gatsby develop and a successful build, the script keeps trying to update .cache/redux and fails due to a permission error. And because of that, it keeps generating these reduxcache directories

修复:按照此处的说明更新到 WSL2:https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

注意:我有时还会看到:

warning Error persisting state: EACCES: permission denied, rename '/home/james/code/gatsby-course-udemy/gatsbyjs-tutorials/.cache/redux' -> '[...]/code/gatsby-course-udemy/gatsbyjs-tutorials/.cache/redux.bak'

...错误,但至少网站正在构建、加载和 运行 没有任何明显的问题!