wails: [V2] Error on wails dev command
Description
- I was receiving the error
ERROR: io: read/write on closed pipewhen executing the commandwails devAt the time wails build would work perfectly fine, but for some reason the dev command was giving me this issue That last night I wasn’t having this issue so I had a friend download the repo to replicate the error, and they received the same exact one. I was wondering if I would be able to reproduce this on older wails projects of mine, and on a project that worked fine and I haven’t touched in weeks gave me the same error.
To Reproduce
Wails V2 CLI beta-42
React TS Template Project
wails dev
Expected behaviour
My project to be hosted in a development environment where I can edit it live.
Screenshots

Attempted Fixes
- I thought it was because of my wails cli version and when switching to a version below beta 40 (I use v39 now) the
wails devcommand worked perfectly fine again.
System Details
System
------
OS: Windows 10 Home
Version: 2009 (Build: 19044)
ID: 21H2
Go Version: go1.18.3
Platform: windows
Architecture: amd64
Wails
------
Version: v2.0.0-beta.42
Dependency Package Name Status Version
---------- ------------ ------ -------
WebView2 N/A Installed 103.0.1264.77
npm N/A Installed 8.15.0
*upx N/A Available
*nsis N/A Available
* - Optional Dependency
Diagnosis
---------
Your system is ready for Wails development!
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (12 by maintainers)
I’ve created the draft PR #1694, which should fix these issues.
@akhudek and @stevohuncho would it be possible for you to try out the PR? That would be awesome 🙏
The original issue is different though, it’s that
wails devwasn’t surfacing errors innpm installand instead just giving a broken pipe error. So there are two issues at play.When you do
wails devit currently does, in order:npm install,npm run dev,npm run build. The issue I’m facing is that running build after running dev causes conflicts and the dev watcher dies.The easiest would probably be to internally add a buildOption to only build the frontend. Then replace the following code-block with a call to just build the frontend
_, err := build.Build(buildOptionsFrontendOnly)https://github.com/wailsapp/wails/blob/b33211495ef8acd0a4637b283f947d3d0fe64e55/v2/cmd/wails/internal/commands/dev/dev.go#L189-L206
This should fix the problem of discarded output from
frontend:dev:installand also makes sure to build the frontend once before starting thefrontend:dev:watcher.