Hello, I'm a front-end developer, and today I want to tell you about my experience with WSL.
As developers, we choose UNIX-systems because of the easiest way to set up the needed environment. That's why the first thing you do when you buy a windows laptop is installing Linux.
But since Microsoft introduced WSL, there are a lot of articles on the internet about how to set up a convenient working environment using this technology. The advantage of this approach is that you do not lose the windows environment. Sometimes this can be important for your hardware, for your user experience, or if you still want to use any Windows applications. And I honestly tried to do it for about a year. During this time I was lucky to participate in several projects. However, in almost all of them, I came across various kinds of problems.
Tools
Firstly, I was slightly annoyed by the fact that in addition to installing git in WSL, I had to install git on Windows to activate VSCode functions. And these were two different versions of git, which did not lead to any negative consequences, but the fact itself was alarming. I also tried this solution https://github.com/andy-5/wslgit, but the GitLens extension doesnβt work with it.
The second unpleasant thing was the Windows console. We must pay tribute, Microsoft has greatly improved it in the latest editions. However, this is still not comparable to the solutions that are for Linux. I know there are projects like Hyper and Terminus. But they are slower, than default CMD. Maybe this is because they are based on Electron, I'm not sure. That's why I'm used CMD. And I also used improved window layouts in Windows 10 to display up to 4 console windows on one desktop. For working with windows and desktops in Windows 10, I can only praise Microsoft. It's done cool. But you are not here to listen to laudatory comments about Windows and Microsoft, you want to know what can upset you.
Colors ... colors in CMD sucks is not good. And I hate the configuration of it. There are great turnkey solutions that change the CMD color scheme through the Windows registry, and I also created my color scheme (attention, at times the combination of text color and selection is unreadable). But be very careful, because if you try to change the color scheme in the CMD properties settings, it will be saved in the shortcut data and the settings from the registry will not be applied... π« You can read more about this here.
Below I will talk about what problems with WSL I had directly in work.
Development
If you are a front-end developer and begin your journey in the development of mobile applications, perhaps you will choose to React Native as it is pretty close to what you already know. And in this case, Expo will be a good choice as a toolkit, because it is very convenient and easy to start. I did just that and... ran into the rather strange problem, described in this issue https://github.com/expo/expo-cli/issues/99.
After several minutes of Expo's work, all network requests fail. Only restarting WSL helped. It was very difficult to work in this mode. Having found this issue, I found a comment by Alexander Martin: "Can confirm that Windows Insider Build 18890 fixes this issue". Since it was very important for me to establish a workflow, I had to switch to Insider Preview mode. And yes, after that, Expo worked fine, and as a bonus, I got a broken hibernation mode, problems with getting out of sleep, and small problems with sound on my laptop.
The next time I needed to install MongoDB locally, however, as stated on the official website: "MongoDB does not support WSL". I have no solution in this regard because in the end a remote connection was used.
The last factor that convinced me to return to Linux was the need to develop an application on Electron. Since WSL does not support window mode, this is not possible.
Besides, there were other cases when something did not compile or did not work as expected, but I can't recall the details.
You may notice that these cases are not directly related to front-end development, but I did not set myself such a goal. I just want to warn you that whatever you do, the WSL may fail you, and sometimes it can be critical.
Conclusion
We prefer Linux to Windows because it simplifies the search for tools, the setup of the working environment and allows us to focus on solving problems. However, WSL is currently even worse than pure Windows, because it looks like the perfect solution and breaks at the most unexpected moment. At the same time, WSL problems are worse to solve, because for the community it is still a dark horse.
Now I am returning to Linux, I hope you take into account my experience and avoid my mistakes. However, if you still decide to try WSL yourself, I think this will be useful to you. Thanks for attention and please comment about your cases.
Top comments (1)
I can confirm the problem: WSL is really a huge step forward, if you are developing on Windows. Until it breaks. In my case, all dynamic ports are bound but not released anymore, resulting in the machine not being able to access anything outside anymore.
A Docker container with X looks like the most reproducible solution to me, however it needs again a lot of work. So I am probably constrained to jump on the Insider-program-train. I'm a little bit troubled, though, as it is my work machine.
My problem: superuser.com/questions/1399063/ws...