tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] The system cannot find the file specified on `tauri dev`

Open ShaunSHamilton opened this issue 2 years ago • 4 comments

Describe the bug

Running npm run tauri dev yields:

> tauri

     Running BeforeDevCommand (`npm run dev`)

> [email protected] dev
> vite


  VITE v3.0.2  ready in 561 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
        Info Watching C:\Users\shauh\Documents\chat\src-tauri for changes...
   Compiling app v0.1.0 (C:\Users\shauh\Documents\chat\src-tauri)
    Finished dev [unoptimized + debuginfo] target(s) in 4.16s
thread 'main' panicked at 'error while running tauri application: Runtime(CreateWebview(WebView2Error(WindowsError(Error { code: 0x80070002, message: The system cannot find the file specified.
 }))))', src\main.rs:9:10

Reproduction

  1. Run npm create tauri-app
  2. Select the vite with React and TypeScript template
  3. cd into app
  4. npm install
  5. npm run tauri dev

Expected behavior

I expect the starter boilerplate to develop, as no other changes have been made.

Platform and versions

Environment
  › OS: Windows 10.0.22000 X64
  › Webview2: 103.0.1264.49
  › MSVC:
      - Visual Studio Build Tools 2019
  › Node.js: 18.6.0
  › npm: 8.13.2
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.25.1
  › rustc: 1.62.1
  › cargo: 1.62.1
  › Rust toolchain: stable-x86_64-pc-windows-msvc

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

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

App directory structure
  ├─ dist
  ├─ node_modules
  ├─ public
  ├─ src
  └─ src-tauri

Stack trace

thread 'main' panicked at 'error while running tauri application: Runtime(CreateWebview(WebView2Error(WindowsError(Error { code: 0x80070002, message: The system cannot find the file specified.
 }))))', src\main.rs:9:10
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\result.rs:1785
   3: enum$<core::result::Result<tuple$<>,enum$<tauri::error::Error> >, 0, 26, Err>::expect<tuple$<>,enum$<tauri::error::Error> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\result.rs:1035
   4: app::main
             at .\src\main.rs:7
   5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:248

Additional context

Oddly, I am on Windows 11 - not 10 like it appears from tauri info.

I have tried with both Nodejs v16 and v18. Also, I have tried with both rustc/cargo v1.61 and v1.62. Same result.

ShaunSHamilton avatar Jul 19 '22 22:07 ShaunSHamilton

Weird, that error typically means that WebView2 is not installed, which is not the case according to tauri info 🤔

And about the Windows version number: it's actually not that odd considering that windows 11 is windows 10 with some ui changes. And btw the value we display is what the OS itself reports back. The only difference here is the build number, 19xxx is windows 10 and 2xxxx is windows 11

FabianLars avatar Jul 19 '22 22:07 FabianLars

Can you try re-running the WebView2 installer? Maybe manually executing it with elevated permissions?

FabianLars avatar Jul 19 '22 22:07 FabianLars

The only difference here is the build number, 19xxx is windows 10 and 2xxxx is windows 11

Ah. Thank you for clearing that up.

Can you try re-running the WebView2 installer?

I should have mentioned - this was one of the first things I tried. Initially, the installer just failed with the error that WebView2 is already installed. After that, I tinkered with some settings to disable and re-enable it (I do not know if I actually managed to do anything here).

ShaunSHamilton avatar Jul 19 '22 22:07 ShaunSHamilton

I would try updating the MSVC by installing Microsoft Visual Studio Build Tools 2022. Is the Windows SDK installed too? @ShaunSHamilton Probably something went wrong in the installation process.

lucasfernog avatar Aug 02 '22 17:08 lucasfernog

I encountered the same problem, and install webview2, this is solved

tu6ge avatar Aug 19 '22 12:08 tu6ge

Closing as stale, and I have not found time to further investigate/troubleshoot.

ShaunSHamilton avatar Sep 29 '22 23:09 ShaunSHamilton

Hi, I got this issue popping up too. My tauri info says I have WebView2 and if I try to install WebView2, the installer says that it's already installed. My tauri info:

Environment
  › OS: Windows 10.0.22000 X64
  › Webview2: 111.0.1661.54
  › MSVC:
      - Visual Studio Community 2022
  › Node.js: 19.4.0
  › npm: 9.2.0
  › pnpm: 7.29.0
  › yarn: Not installed!
  › rustup: 1.25.2
  › rustc: 1.70.0-nightly
  › cargo: 1.70.0-nightly
  › Rust toolchain: nightly-x86_64-pc-windows-msvc

Packages
  › @tauri-apps/cli [NPM]: 1.2.3

Thanks for any help :D

DraftedDev avatar Apr 06 '23 22:04 DraftedDev