tauri: [bug] Tauri v2.0.0-beta failed to build on Windows

Describe the bug

I recently migrated to v2, but encountered some issues. I am not sure if this issue should be raised here, but I think it may be related. When I use github actions, it fails to build on Windows. This may be related to my use of caching, as when I delete the cache, it can be successfully built. But why? This is a bit strange because there was no such issue in v1.

Reproduction

https://github.com/A-kirami/tauri-windows-build

https://github.com/A-kirami/tauri-windows-build/actions/runs/8108131093/job/22160785334

Expected behavior

It should be built successfully on Windows like v1.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.20348 X64
    ✔ WebView2: 119.0.2151.58
    ✔ MSVC: Visual Studio Enterprise 2022
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.11.1
    - pnpm: 8.15.4
    - yarn: 1.22.21
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.8
    - tauri-build [RUST]: 2.0.0-beta.6
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.3
    - @tauri-apps/cli [NPM]: 2.0.0-beta.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Stack trace

error: failed to run custom build command for `tauri-app v0.0.0 (D:\a\tauri-windows-build\tauri-windows-build\src-tauri)`

Caused by:
  process didn't exit successfully: `D:\a\tauri-windows-build\tauri-windows-build\src-tauri\target\release\build\tauri-app-24127a8263a01426\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  cargo:rustc-env=TAURI_ANDROID_PACKAGE_PREFIX=com_tauri
  failed to read plugin permissions: failed to read file: The system cannot find the file specified. (os error 2)
warning: build failed, waiting for other jobs to finish...
       Error failed to build app: failed to build app
 ELIFECYCLE  Command failed with exit code 1.
Error: Command failed with exit code 1: pnpm tauri build -t x86_64-pc-windows-msvc

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 5
  • Comments: 17 (9 by maintainers)

Most upvoted comments

For me, what fixed it was deleting the scr-tauri/target/debug/build folder and then running npm run tauri dev again. Once I did that I also noticed that my antivirus put some of the files in quarantine, so I had to put that folder on the whitelist.

I’m back with results, tested -t x86_64-pc-windows-msvc as recommended, and I’ve seen no issues in 7 re-runs of the build, without any changes to caching.

Looks like adding a target somehow makes a difference?