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

Live reload does not work with WSL2 #1150

Closed
@kaito3desuyo

Description

@kaito3desuyo

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.

Activity

thetylerreiff

thetylerreiff commented on Apr 11, 2020

@thetylerreiff

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

kaito3desuyo commented on Apr 12, 2020

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

dmtrshat commented on Apr 14, 2020

@dmtrshat

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

Conduitry commented on Apr 14, 2020

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

AlbertMarashi commented on Nov 9, 2020

@AlbertMarashi

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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @thetylerreiff@kaito3desuyo@Conduitry@AlbertMarashi@dmtrshat

        Issue actions

          Live reload does not work with WSL2 · Issue #1150 · sveltejs/sapper