Hello everyone,
I am looking into Wordpress theme development, so I wanted to create a local install on my machine to test things out, however I can't get it to work and I could really use some help.
I used the guide from the Wordpress docs to set up wp-env through node.js. It requires docker to work, which is where I am running into some issues. The guide suggests using the docker desktop app, however I do not want to use proprietary software, so I am using docker through the command line. From my internet research, wp-env should work with or without the docker desktop app.
First I installed docker with no issues using:
sudo apt install docker.io
Then I launched it as a system service, so it was running in the background using:
sudo systemctl start docker
Looking at its status with sudo systemctl status docker it says it is active (running).
Then I created a new project with npm init for the package.json file, and then I installed wp-env as a dev dependency.
I tried to launch it using npx wp-env start and I got this error:
Could not connect to Docker. Is it running?
I did some research and guessed that it was a permissions error, so I used sudo npx wp-env start and got a new error:
/home/username/Coding/wordpress/node_modules/@wordpress/env/lib/config/parse-config.js:155
localConfig ?? {},
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:85:18)
at Object.<anonymous> (/home/username/Coding/wordpress/node_modules/@wordpress/env/lib/config/load-config.js:13:44)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
I have no idea why I got a syntax error in a node module; I did not change the file. I tried reinstalling the node modules, creating a new project, and clearing the npm cache, but none of that worked. For reference the version of node.js I am using is 22.21.0.
I am not sure where to go from here. Does anyone have any suggestions for how I may fix this? Did I set up docker wrong? Or should I just try to set up a LAMP stack with Wordpress manually?
Thanks in advance for any help
!