Setup on Windows

Special setup when developing in the Windows platform.

Windows does not have native support for Bash, the file system or package management like Linux. So you'll need to use Windows Subsystem for Linux (WSL), more specifically WSL 2. This guide and the commands below are adjusted for Ubuntu. Different distributions have other requirements and require different packages to work.

Install WSL 2

Follow these instructions to install WSL 2. Depending on how recent your Windows build is, you will either be able to do it with a single command, or have to follow several step-by-step directions.

After this, you probably need to reboot.

After installation, whenever you want to enter the Linux Subsystem, start Windows PowerShell as Administrator and simply type:

wsl

Install tools in WSL

From WSL, install all the software mentioned in Developer prerequisites. Here are some commands that will do most of it for you:

# Install NVM & NPM (replace 9.5.0 with whatever version you want to start with)
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
nvm install 9.5.0
nvm use 9.5.0
npm install
sudo apt update

# Install cUrl
sudo apt-get install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

# Install Homebrew
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile

# Install PHP
brew install php

# Install Composer
brew install composer

# Install Gulp (Not needed?)
sudo apt install gulp

# Install Gulp-cli
brew install gulp-cli

# Install Docker 
sudo apt install apt-transport-https ca-certificates curl software-properties-common
sudo apt remove gpg # Common issue on WSL, therefore you'll need gnupg1
sudo apt install gnupg1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-get install software-properties-common
sudo apt-add-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-compose
sudo apt install net-tools

Docker Desktop settings

Install Docker Desktop for Windows. In the settings, make sure to check "Use the WSL 2 based engine".

You might need to restart your WSL console after this.

Configure Git

Add the following in your .gitconfig file, to make sure that repositories that you check out don't get windows-style linebreaks:

[core]
    autocrlf = input
    eol = lf

For Starter Kit

After running Starter Kit's make init and make start, both the dockers and the project file tree will be accessible from both Windows and WSL.

It is common to get error messages concerning NPM (see below). NPM is not strictly necessary to run in WSL; it is used by Gulp to compile CSS and JS files for your project, but you are free to use other tools for that if you prefer.

Common NPM problem

A common problem when running Everyware projects on WSL is Gulp not working, especially because a node binding for node-sass cannot be found.

It might actually be easier for you to install NPM and gulp-cli from a Windows command-line rather than WSL. Then you can run Gulp in Windows:

gulp

If you want to do it in WSL anyway, you will need to rebuild node-sass manually after installing NPM. If your project has Starter Kit 2.0.0, this can be done easily with make commands:

make npm install
make npm rebuild node-sass

After that, you can run Gulp:

make gulp

If you are running an earlier version, you can run the same commands directly to the node builder instead:

docker run --rm -v $(pwd):/app -v $HOME/.npm:/.npm infomakerscandinaviaab/navigaweb-node-builder:1.0.0 npm install
docker run --rm -v $(pwd):/app -v $HOME/.npm:/.npm infomakerscandinaviaab/navigaweb-node-builder:1.0.0 npm rebuild node-sass
docker run --rm -v $(pwd):/app -v $HOME/.npm:/.npm infomakerscandinaviaab/navigaweb-node-builder:1.0.0 gulp

Last updated