I’ve recently set up a WordPress project inside the WSL2 filesystem (/home/john/projects) and am using DDEV to manage my local environment. After starting the DDEV container, I navigate into my theme directory within the DDEV terminal and run: npm install.
Normally, this process completes within about 30 seconds. However, inside DDEV, it takes much longer (~10 minutes) and eventually fails with the following error related to esbuild:
npm error code 1
npm error path \\wsl.localhost\DDEV\home\john\project\wp-content\themes\project-theme\node_modules\esbuild
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c node install.js
npm error '\\wsl.localhost\DDEV\home\john\project\wp-content\themes\project-theme\node_modules\esbuild'
npm error CMD.EXE was started with the above path as the current directory.
npm error UNC paths are not supported. Defaulting to Windows directory.
npm error node:internal/modules/cjs/loader:1228
npm error throw err;
npm error ^
npm error
npm error Error: Cannot find module 'C:\Windows\install.js'
npm error at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
npm error at Function._load (node:internal/modules/cjs/loader:1055:27)
npm error at TracingChannel.traceSync (node:diagnostics_channel:322:14)
npm error at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
npm error at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
npm error at node:internal/main/run_main_module:36:49 {
npm error code: 'MODULE_NOT_FOUND',
npm error requireStack: []
npm error }
npm error
npm error Node.js v22.14.0
I can see that the issue is with esbuild and UNC paths but was unable to find any fixes for this. Any suggestions on how best to debug or fix this?
ddev npm ...