windowsvue.jsrusttaurisidecar

Tauri app build error Couldn't to execute windres to compile


I am trying to build Tauri/Vuejs desktop app with Nestjs as the sidecar when I run the build command npm run tauri build I get this error :

error: failed to run custom build command for `app v0.1.0 (E:\ItharApp\ithar_front\ithar-vite\src-tauri)`

Caused by:
  process didn't exit successfully: `E:\ItharApp\ithar_front\ithar-vite\src-tauri\target\release\build\app-a8fa9116a38b9151\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  cargo:rerun-if-changed=binaries\ithar-backend-x86_64-pc-windows-gnu.exe
  package.metadata does not exist

  --- stderr
  thread 'main' panicked at C:\Users\alaed\.cargo\registry\src\index.crates.io-6f17d22bba15001f\embed-resource-2.2.0\src\windows_not_msvc.rs:49:23:
  Couldn't to execute windres to compile "E:\ItharApp\ithar_front\ithar-vite\src-tauri\target\release\build\app-cd259cb30a055ed2\out\resource.rc" into "E:\ItharApp\ithar_front\ithar-vite\src-tauri\target\release\build\app-cd259cb30a055ed2\out/libresource.a": program not found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
       Error failed to build app: failed to build app

I did all the configurations for the sidecar as follows :

depending one the docs : https://tauri.app/v1/guides/building/sidecar

tauri.conf.json:

{
  "$schema": "../node_modules/@tauri-apps/cli/schema.json",
  "build": {
    "beforeBuildCommand": "npm run build",
    "beforeDevCommand": "npm run dev",
    "devPath": "http://localhost:5173",
    "distDir": "../dist"
  },
  "package": {
    "productName": "ithar-vite",
    "version": "0.1.0"
  },
  "tauri": {
    "allowlist": {
      "all": false,
      "shell": {
        "sidecar": true,
        "scope": [
          { "name": "binaries/ithar-backend", "sidecar": true }

        ]
      }
    },
    "bundle": {
      "active": true,
      "category": "DeveloperTool",
      "copyright": "",
      "deb": {
        "depends": []
      },
      "externalBin": ["binaries/ithar-backend"],
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "identifier": "com.ithar.sidecar",
      "longDescription": "",
      "macOS": {
        "entitlements": null,
        "exceptionDomain": "",
        "frameworks": [],
        "providerShortName": null,
        "signingIdentity": null
      },
      "resources": [],
      "shortDescription": "",
      "targets": "all",
      "windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": ""
      }
    },
  
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "Ithar Desk",
        "width": 800
      }
    ]
  }
}

Cargo.toml:

[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.60"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.4.0", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4.0", features = [ "shell-sidecar", "process-command-api", "windows7-compat"] }
windres = "0.2.2"

[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]

main.rs

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use tauri::{
  api::process::{Command, CommandEvent},
  Manager,
};

fn main() {
  tauri::Builder::default()
    .setup(|app| {
      let window = app.get_window("main").unwrap();
      tauri::async_runtime::spawn(async move {
        let (mut rx, mut child) = Command::new_sidecar("ithar-backend")
          .expect("failed to setup `app` sidecar")
          .spawn()
          .expect("Failed to spawn packaged node");

        let mut i = 0;
        while let Some(event) = rx.recv().await {
          if let CommandEvent::Stdout(line) = event {
            window
              .emit("message", Some(format!("'{}'", line)))
              .expect("failed to emit event");
            i += 1;
            if i == 4 {
              child.write("message from Rust\n".as_bytes()).unwrap();
              i = 0;
            }
          }
        }
      });

      Ok(())
    })
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

can anyone help me what's worng exactlly


Solution

  • I have solved this problem by just reinstalling Rust again