This is split from https://github.com/gatsbyjs/gatsby/issues/21879
There appears to be a problem for a select number of users when Gatsby wants to save the cache. In particular, moving the temp folder to the main cache folder (through a rename) seems to fail. Reported by @talves, @davidalekna, @huy-nguyen, and maybe @wfendler (the source of their problem is probably caused by this).
It appears to affect a lot of WSL users, if not only them. (@wfendler's log output shows a user path that indicates the actual Gatsby calls run on a Windows host as well)
warn Error persisting state: EACCES: permission denied, rename '/mnt/d/Git/Tailwind/tailwind-gatsby-example/www/site/.cache/redux' ->
warn Error persisting state: EACCES: permission denied, rename 'reduxcachex3k3tg' ->
warn Error persisting state: EACCES: permission denied, rename 'reduxcacheN0NDd9' -> '/home/.../Development/.../.docz/.cache/redux'
Here's output by @wfendler although I feel this might be a slightly different issue (still caused or leading to this problem):
ENOENT: no such file or directory, open '/Users/williamfendler/Sites/xxxxxx/.cache/app.js'
failed Re-building development bundle - 0.069s
warning Error persisting state: ENOENT: no such file or directory, rename 'reduxcachem7w4vQ' -> '/Users/williamfendler/Sites/xxxxxx/.cache/redux'
As indicated in the original ticket, the problem started to occur with [email protected], downgrading to .21 is a viable workaround for them.
Another workaround seems to be to force clear (sudo) the ~/.npm
, node_modules
, public
, and .cache
folders and to run npm again. To me that indicates a permission problem. I expect that it's sufficient to clear to the .cache
folder to resolve this problem, but have not confirmed this yet. Also don't know whether the problem returns after doing so.
Need more input on this. Can anyone confirm this problem exists outside of WSL?
Can anyone confirm they have this problem in gatsby build
as well? I only have confirmation for gatsby develop
right now. This would help a lot since there's way more moving parts in develop
.
Hey @pvdz, I get the same error when on WSL and using gatsby build
This is on WSL Version1 running an Ubuntu image.
Hey @pvdz, I think I have found the problem. After deleting the cache and running npm install
again I found that I was hitting EACCES
errors again but unrelated to Gatsby. A bit of a Google investigation yielded this forum post.
I'd opened VS Code from WSL which appears to lock some folders. By closing VS Code and then running gatsby build
I was able to get everything working without having to downgrade or clear any folders.
@buck06191 good catch! Kinda makes sense that it might be caused by VS Code.
If it happens again, I will close VS Code and run the same command from a terminal (WSL) to see if it was VS Code locking it @pvdz
@buck06191 that's great, thanks for letting us know :)
I'll close this issue. If it turns this issue is caused by a different issue please re-open it. Thanks!
Have anyone figure it out how to solve this issue? I now its related to VSCode remote with WSL, but is particullary annoying with gatsby projects.
I've downgraded Gatsby version but still the same, although it kind a works, still creates redux folders every time I save changes so it reloads the webserver.
@julianruizsa I'm not longer experiencing the problem I reported in the related issue #21879
So, if it's helpful, I'm on:
Hi! I'm experiencing this exact problem with Gatsby 2.20.2 (CLI 2.11.0) on Ubuntu WSL (with Windows Terminal) when I use VSCode 1.43.1 馃檨
Seems related to https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace
Was able to resolve by
sudo rm -rf .cache
sudo rm -rf reduxcache*
npm run develop
On VS Code Remote WSL
Hi! I'm experiencing this exact problem with Gatsby 2.20.2 (CLI 2.11.0) on Ubuntu WSL (with Windows Terminal) when I use VSCode 1.43.1 馃檨
Seems related to https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace
Excelent! Thank's a lot. I've just read the issue and seems that is the problem. Currently I'm on WSL1, but I will only get WSL2 when is GA (cuz I don't want to be In any ring in Windows Insider).
Will check the .cache clean option and let you know if works.
Awesome comunity.
This actually resolved the problem for me:
That's a known problem with the WSL file system implementation (Microsoft/WSL#3395, Microsoft/WSL#1956) caused by the file watcher active by VSCode. The issue will only be fixed in WSL 2.
To avoid the issue, set remote.WSL.fileWatcher.polling to true. However, polling based file watching has a performance impact for large workspaces.
original post: https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace
I've changed this flag in VSCode and all is working now. I think the other way is update Windows and upgrading WSL 1 for version 2
Most helpful comment
This actually resolved the problem for me:
original post: https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace
I've changed this flag in VSCode and all is working now. I think the other way is update Windows and upgrading WSL 1 for version 2