tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Error in tauri.conf.json crashes dev server

Open madflow opened this issue 2 years ago • 1 comments

Describe the bug

An invalid value tauri.conf.json when running yarn run tauri devcrashes the dev server.

thing ➜ yarn run tauri dev
yarn run v1.22.19
$ tauri dev
`tauri.conf.json` error on `tauri > windows > 0 > height`: The value must be number
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

When trying to run yarn run tauri dev again - there is still a process running.

➜  yarn run tauri dev
yarn run v1.22.19
$ tauri dev
     Running BeforeDevCommand (`yarn dev`)
        Info Watching /xxx/src-tauri for changes...
$ vite
   Compiling xxx v0.0.0 (/src-tauri)
error when starting dev server:======> ] 325/326: xxx(bin)
Error: Port 1420 is already in use
    at Server.onError (file:////xxx/node_modules/vite/dist/node/chunks/dep-665b0112.js:52451:28)
    at Server.emit (node:events:527:28)
    at emitErrorNT (node:net:1399:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

The current fix is ps aux and kill.

Reproduction

  • I have create a new project with yarn create tauri-app.
  • I have selected the vanilla-ts template
  • I have installed all deps with yarn
  • Start yarn run tauri dev
  • Change the windows height in tauri.conf.json to an invalid value ("abc") and save

Expected behavior

I would expect a better developer experience. Either the dev server should exit cleanly or I should be able to kill all running processes with "tauri"

Platform and versions

Environment
  › OS: Mac OS 12.5.0 X64
  › Node.js: 16.15.1
  › npm: 8.13.1
  › pnpm: 7.5.2
  › yarn: 1.22.19
  › rustup: Not installed!
  › rustc: 1.63.0
  › cargo: 1.63.0
  › Rust toolchain:

Packages
  › @tauri-apps/cli [NPM]: 1.0.5
  › @tauri-apps/api [NPM]: 1.0.2
  › tauri [RUST]: 1.0.5,
  › tauri-build [RUST]: 1.0.4,
  › tao [RUST]: 0.12.2,
  › wry [RUST]: 0.19.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:1420/

App directory structure
  ├─ node_modules
  ├─ src-tauri
  ├─ .vscode
  └─ src
✨  Done in 8.67s.

Stack trace

No response

Additional context

No response

madflow avatar Sep 11 '22 14:09 madflow

In my case (under Mac OS 11.4.0 X64), although the port is not occupied,but the original app has not been terminated. After change invalid number into a valid number, the new app process will be enabled on the new port, and I will get two apps.

Moon1102 avatar Sep 13 '22 01:09 Moon1102