Skip to main content

Installing wp-env

wp-env is pretty nice and the .wp-env.json file makes me think it's most of the way there as a generic local wp setup. of course it doesn't have redis / composer / support for multiple php versions, caching plugins, and dev tools installed with it.

Requirements

Requires nvm and docker.

Installation

First install docker-compose (this script doesn't work with docker compose):

# On Debian or derivatives
$ sudo apt install docker-compose -y

Then install wp-env

# Install and use the latest LTS node
$ nvm install --lts
$ nvm use lts/*

# Install wp-env as a global node LTS package
$ npm install --global @wordpress/env

Usage

Now it's ready:

$ cd ~/path/to/myplugin

# Now you can use it anytime
$ wp-env start
WordPress development site started at http://localhost:8888/
WordPress test site started at http://localhost:8889/
MySQL is listening on port 32773
MySQL for automated testing is listening on port 32772

$ wp-env stop
✔ Stopped WordPress. (in 3s 165ms)`

The information is based on the official wp-env announcement