wails icon indicating copy to clipboard operation
wails copied to clipboard

Getting this Error on `wails dev`: "Error: failed to find Vite server URL" and dev windows not opening

Open riyanswat opened this issue 1 year ago • 6 comments

Description

I've been getting this error for the last few days. It used to be fine and would open a new window that would instantly show the changes I made in the frontend. But now when I run wails dev, it throws the following error:

DEB | Using go webview2loader
Wails CLI v2.6.0

Executing: go mod tidy
  • Installing frontend dependencies: Done.
  • Compiling frontend: Done.

  ERROR   failed to find Vite server URL

To Reproduce

wails dev

Expected behaviour

It should open a windows (just like before) and should reflect any changes I made to the frontend.

Screenshots

No response

Attempted Fixes

  • I looked up the issue and saw that someone had suggested changing the frontend:dev:serverUrl and I changed "frontend:dev:serverUrl": "auto" in the wails.json file to a localhost url but it still didn't work. (This issue and the suggested solutions didn't work either: https://github.com/wailsapp/wails/issues/1611)
  • I reinstalled Vite and wails and started from scratch... but to no avail

System Details

E:\pass_manager_wails>wails doctor
DEB | Using go webview2loader


          Wails Doctor



# Wails
Version | v2.6.0

# System
┌────────────────────────────────────┐
| OS           | Windows 10 Pro      |
| Version      | 2009 (Build: 19045) |
| ID           | 22H2                |
| Go Version   | go1.21.2            |
| Platform     | windows             |
| Architecture | amd64               |
└────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 119.0.2151.97 |
| Nodejs     | N/A          | Installed | 18.18.1       |
| npm        | N/A          | Installed | 9.8.1         |
| *upx       | N/A          | Available |               |
| *nsis      | N/A          | Available |               |
└─────────────── * - Optional Dependency ───────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Additional context

No response

riyanswat avatar Dec 03 '23 17:12 riyanswat

If you run Vite outside of Wails what url does it listen on?

leaanthony avatar Dec 03 '23 20:12 leaanthony

Wails CLI v2.6.0

Executing: go mod tidy • Generating bindings: Done. • Installing frontend dependencies: Done. • Compiling frontend: Done.

[email protected] dev vue-cli-service serve

INFO Starting development server... [92%] sealing (asset processing SourceMapDevToolPlugin)

ERROR failed to find Vite server URL ♥ If Wails is useful to you or your company, please consider sponsoring the project: https://github.com/sponsors/leaanthony node:events:491
throw er; // Unhandled 'error' event ^

Error: write EPIPE at afterWriteDispatched (node:internal/stream_base_commons:160:15) at writeGeneric (node:internal/stream_base_commons:151:3) at Socket._writeGeneric (node:net:905:11) at Socket._write (node:net:917:8) at writeOrBuffer (node:internal/streams/writable:391:12) at _write (node:internal/streams/writable:332:10) at Socket.Writable.write (node:internal/streams/writable:336:10) at render (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/log-update/index.js:40:10) at handler (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected][email protected]/node_modules/progress-webpack-plugin/index.js:117:7) at Object.call (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/ProgressPlugin.js:507:6) at Hook.eval [as callAsync] (eval at create (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/tapable/lib/HookCodeFactory.js:33:10), :8:18) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/tapable/lib/Hook.js:18:14) at Compiler.emitAssets (/Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/Compiler.js:878:19) at /Users/lvluo/Desktop/github.com/js+ui/test-gui/frontend/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/Watching.js:181:21 at processTicksAndRejections (node:internal/process/task_queues:78:11) Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -32, code: 'EPIPE', syscall: 'write' }

ctfang avatar Dec 04 '23 13:12 ctfang

cd frontend using npm run dev is normal.

ctfang avatar Dec 04 '23 13:12 ctfang

If you run Vite outside of Wails what url does it listen on?

In the frontend dir in the wails app, the url is http://localhost:5173/

riyanswat avatar Dec 04 '23 17:12 riyanswat

cd frontend using npm run dev is normal.

Yes, but why isn't wails dev throwing that error? I want to get the wails dev command to work but I don't know why it's causing that issue.

riyanswat avatar Dec 04 '23 17:12 riyanswat

Looks like a node compatibility issue. Try +1 and -1 versions via nvm

leaanthony avatar Dec 04 '23 18:12 leaanthony