Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL: Problem renaming reduxcache while saving the redux cache #21982

Closed
pvdz opened this issue Mar 5, 2020 · 11 comments
Closed

WSL: Problem renaming reduxcache while saving the redux cache #21982

pvdz opened this issue Mar 5, 2020 · 11 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@pvdz
Copy link
Contributor

pvdz commented Mar 5, 2020

This is split from #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)

Example logs

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'

Bisect and workaround

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?

@pvdz pvdz added the type: bug An issue or pull request relating to a bug in Gatsby label Mar 5, 2020
@pvdz
Copy link
Contributor Author

pvdz commented Mar 5, 2020

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.

@buck06191
Copy link

Hey @pvdz, I get the same error when on WSL and using gatsby build
image
This is on WSL Version1 running an Ubuntu image.

@buck06191
Copy link

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.

@talves
Copy link
Contributor

talves commented Mar 6, 2020

@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

@pvdz
Copy link
Contributor Author

pvdz commented Mar 10, 2020

@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!

@pvdz pvdz closed this as completed Mar 10, 2020
@julianruizsa
Copy link

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.

@wfendler
Copy link

@julianruizsa I'm not longer experiencing the problem I reported in the related issue #21879

So, if it's helpful, I'm on:

  • Gatsby CLI version: 2.10.11
  • Gatsby version: 2.19.45
  • Visual Studio Code Version: 1.43.1

@jorgeorpinel
Copy link

jorgeorpinel commented Mar 22, 2020

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

@smartexpert
Copy link

Was able to resolve by

sudo rm -rf .cache
sudo rm -rf reduxcache*
npm run develop

On VS Code Remote WSL

@julianruizsa
Copy link

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.

@pccassin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

8 participants