DEV Community

mmyoji
mmyoji

Posted on

Is it possible to use Windows Subsystem for Linux in web development?

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

English

Install the Linux Subsystem on Windows 10 | Microsoft Docs

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

Install the latest version of wslgit.exe from here and put it wherever you like. (I put it under /mnt/c/Users/mmyoji/)

The VSCode setting file are like following:

{
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
  "git.path": "C:\\Users\\<username>\\wslgit.exe"
}
Enter fullscreen mode Exit fullscreen mode

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

$ 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
Enter fullscreen mode Exit fullscreen mode

Setup Terminal - Hyper

I cannot stay calm with Command Prompt nor PowerShell and took Hyper.

  • 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:

// .hyper.js
{
  // ....
  plugins: [
    'hyper-dracula' // theme plugin
  ]
}
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (2)

Collapse
 
rajeshroyal profile image
Rajesh Royal

Installing and running WSL for web development is easy as peace of cake. I do all the company work from WSL [ Linux-shell ] and I use VS-Code as editor.

About your opinion for heavy web development task: dude I'm running a full-stack enterprise application which includes [nodejs, MongoDB, Reactjs, cordova]. You could do better research or you can test things yourself first before publishing, just feedback no offence.

Collapse
 
buenopw_16 profile image
Bueno

Just installed a "modern web development environment" and it's pretty fine. Maybe other Windows 10 version are better to go.