Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Live reload does not work with WSL2 #1150

Closed
kaito3desuyo opened this issue Apr 11, 2020 · 5 comments
Closed

Live reload does not work with WSL2 #1150

kaito3desuyo opened this issue Apr 11, 2020 · 5 comments

Comments

@kaito3desuyo
Copy link

Describe the bug
Live reload does not work with WSL2

Logs
No logs

To Reproduce

  1. npx degit "sveltejs/sapper-template#rollup" my-app (also same problem with webpack)
  2. App start with WSL2 (source code is located in /mnt/c/***)

Expected behavior
The app should be reloaded if the source code changes

Information about your Sapper Installation:

  • Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc)
    Windows 10 x64 2004 19041.172 (insider preview) + WSL2 Ubuntu 18.04

  • Your hosting environment: (i.e. Local, GCP, AWS, Now, etc...)
    Local

  • Sapper version (Please check you can reproduce the issue with the latest release!)
    v0.27.0

  • Svelte version (Please check you can reproduce the issue with the latest release!)
    v3.0.0

  • Whether your application uses Webpack or Rollup
    Rollup

Severity
Inhibits comfortable development.

@thetylerreiff
Copy link

thetylerreiff commented Apr 11, 2020

Is the project directory outside the WSL root directory? I believe this is a know issue with WSL2. Try moving the project into your home dir.

@kaito3desuyo
Copy link
Author

Is the project directory outside the WSL root directory? I believe this is a know issue with WSL2. Try moving the project into your home dir.

yeah, source code located in /mnt/c/something.

When I created a project in the root directory of WSL, it worked fine.

@dmtrshat
Copy link

dmtrshat commented Apr 14, 2020

Is the project directory outside the WSL root directory? I believe this is a know issue with WSL2. Try moving the project into your home dir.

yeah, source code located in /mnt/c/something.

When I created a project in the root directory of WSL, it worked fine.

Yep
It's all about the file sharing protocol. wsl2 now works with the 9P protocol, which may not currently support the file change event.
At this point, the easiest solution is to transfer files to the linux home directory.

P.S. Also, if you transfer files, wsl2 speed will increase

@Conduitry
Copy link
Member

Huh I didn't realize that WSL2 didn't support file events on the host disk (yet?) and I no longer think I will be switching to it when it's officially released.

In any case, if this is a known limitation in WSL2, I think this should be closed. Sapper should have a reasonable expectation that certain features be available in its environment, and we don't want to have to worry about this specific case.

@AlbertMarashi
Copy link

Using WSL 2 with docker containers

Deleting my node_modules in my project, and deleting rollup in my C:\Program Files\nodejs\node_modules global folder and force reinstalling with npm i -g rollup --force worked for me.

Make sure to install your code in a linux filesystem instead of using WSL file-sharing (eg: put your files in an Ubuntu filesystem, and use VSCode Remote-WSL extension)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants