Is it possible to use Windows Subsystem for Linux in web development?
Tags: windows, wsl
Published: 2018-01-13 06:54:12

---
title: Is it possible to use Windows Subsystem for Linux in web development?
published: true
tags: windows,wsl
---

I got a Windows 10 Home PC for gaming(PUBG) and tried Windows Subsystem for Linux (a.k.a. Bash on Ubuntu on Windows) in web development.


## Conclusion

You can use WSL for _light_ web development.

For example,

* web frontend development (using webpack)
* small web app (use Sinatra)
* etc.

It's NOT suitable for heavy or modern development environment.

At least, Windows10 Home edition can't use Docker in easy way.

I've never tried Windows10 Pro + Docker for Windows and I read some articles about it, it didn't seem to be easy.


## Languages

I installed and tried following languages:

* Node.js
* Ruby
* Golang


## Setup Windows Subsystem for Linux

It's not difficult at all! I skip the instruction.


Japanese

> [Windows Subsystem for Linuxをインストールしてみよう！ - Qiita](https://qiita.com/Aruneko/items/c79810b0b015bebf30bb)

English

> [Install the Linux Subsystem on Windows 10 | Microsoft Docs](https://docs.microsoft.com/en-us/windows/wsl/install-win10)


## Editor - VSCode

I'm using NeoVim in my current main dev environment on Xubuntu.

But I discard NeoVim at this time and chose VSCode.

It's easy to install and configure, and I wanted to use it a little.

You just need to care about the terminal and git path setting.

> [Visual Studio CodeでWSLのgitを利用してソース管理を行う - Qiita](https://qiita.com/xerespm/items/ed4d659cfac4a1695f4b)

Install the latest version of `wslgit.exe` from [here](https://github.com/andy-5/wslgit/releases) and put it wherever you like. (I put it under `/mnt/c/Users/mmyoji/`)

The VSCode setting file are like following:


```json
{
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
  "git.path": "C:\\Users\\<username>\\wslgit.exe"
}
```

Replace the `<username>` of your name like `mmyoji`.

Install plugins you like.

However, Golang integration with VSCode not worked when you install Gplang under WSL. If you want to use VSCode with Golang, it might be better to install to Windows itself.


## Setup node

The versions of node and npm via apt is too old and the installation process was a bit bothering.

> [Ubuntuに最新のNode.jsを難なくインストールする - Qiita](https://qiita.com/seibe/items/36cef7df85fe2cefa3ea)

```sh
$ sudo apt install -y nodejs-legacy npm
$ sudo npm i -g n

# Install latest node
$ sudo n stable
$ sudo ln -sf /usr/local/bin/node /usr/bin/node

$ node -v
v9.2.1
$ npm -v
5.5.1

$ sudo apt purge -y nodejs-legacy npm
```


## Setup Terminal - Hyper

I cannot stay calm with Command Prompt nor PowerShell and took [Hyper](https://hyper.is/).

* Get `Hyper` from the official site.
* Install plugins if you want.

The config file was located under `/mnt/c/Users/mmyoji` in my environment.

This is an example:

```js
// .hyper.js
{
  // ....
  plugins: [
    'hyper-dracula' // theme plugin
  ]
}
```

And select `View` -> `Full Reload` from `hyper` options.

It's easy to customize and I like it.


## Setup Ruby environment

* Worked normal rbenv / ruby-build setup instructions with `git`
* Install `$HOME/.rbenv` and add some script in `$HOME/.bashrc` (not `$HOME/.bash_profile`)
* One thing:
  * before running `rbenv install 2.5.0`, you have to install `readline`
  * `$ sudo apt install -y libreadline-dev`


## Setup Golang

You can do the same setup operation like Linux.

But WSL+VSCode integration is not supported well.


## Setup Docker

If you have to handle dockerized applications, you have to use:

* Windows 10 Pro & Docker for Windows (and some customize)
* Docker Toolbox(VirtualBox)
* macOS
* Linux

There might be a good solution, I couldn't find it for now.


## Conclusion, again

It's a bit difficult to use Windows10 Home for modern web development.

Linux is better for it.

But you can use Windows10 Home as **light** dev environment as I said above.

Thanks.