Describe the bug
Attempting to use a fixed WebView2 runtime fails in dev mode in Windows. Creating a production .msi installer does work and packages the runtime correctly, however. The issue seems to only be when trying to run in development, e.g., npm run tauri:serve
Reproduction
- Create a new tauri app
- Download a fixed version runtime from https://developer.microsoft.com/en-us/microsoft-edge/webview2/
- Extract the .cab file to
./src-tauri/webview2/, which creates a Microsoft.WebView2.FFixedVersionRuntime.102.x.xxx... folder
- In
tauri.conf.json add webviewFixedRuntimePath to tauri > bundle > windows with webview2/Microsoft.WebView2.FFixedVersionRuntime.102.x.xxx.../ for the path value
- Try and run
npm run tauri:serve
- App crashes on startup with error...
Finished dev [unoptimized + debuginfo] target(s) in 9.19s
Running `target\debug\APP_NAME.exe`
}))))', src\main.rs:332:10error while running tauri application: Runtime(CreateWebview(WebView2Error(WindowsError(Error { code: 0x80070002, message: The system cannot find the file specified.
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\panicking.rs:584
1: core::panicking::panic_fmt
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src\panicking.rs:143
2: core::result::unwrap_failed
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src\result.rs:1785
3: enum$<core::result::Result<tuple$<>,enum$<tauri::error::Error> >, 0, 27, Err>::expect<tuple$<>,enum$<tauri::error::Error> >
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\core\src\result.rs:1035
4: APP_NAME::main
at .\src\main.rs:304
5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\APP_NAME.exe` (exit code: 101)
Expected behavior
App should start as expected but using the fixed webview2 runtime
Platform and versions
Not sure why the output of `tauri info` shows that Webview2 is not installed, but it is!
Environment
› OS: Windows 10.0.18363 X64
› Webview2: Not installed!
› MSVC:
- Visual Studio Build Tools 2019
› Node.js: 16.13.0
› npm: 8.1.0
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.24.3
› rustc: 1.61.0
› cargo: 1.61.0
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.0.0-rc.13
› @tauri-apps/api [NPM]: 1.0.0-rc.6
› tauri [RUST]: 1.0.0-rc.14,
› tauri-build [RUST]: 1.0.0-rc.12,
› tao [RUST]: 0.9.1,
› wry [RUST]: 0.17.0,
App
› build-type: bundle
› CSP: default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
› distDir: ../dist
› devPath: http://localhost:8080/
› framework: Vue.js (Vue CLI)
› bundler: Webpack
App directory structure
├─ .git
├─ dist
├─ node_modules
├─ public
├─ resources
├─ src
└─ src-tauri
Stack trace
No response
Additional context
Example repo: https://github.com/ksumarine/tauri-dev-webview2runtime-issue
- FYI, runtime files are not included, the .cab must be downloaded and extracted into the project
Describe the bug
Attempting to use a fixed WebView2 runtime fails in dev mode in Windows. Creating a production .msi installer does work and packages the runtime correctly, however. The issue seems to only be when trying to run in development, e.g.,
npm run tauri:serveReproduction
./src-tauri/webview2/, which creates aMicrosoft.WebView2.FFixedVersionRuntime.102.x.xxx...foldertauri.conf.jsonaddwebviewFixedRuntimePathtotauri > bundle > windowswithwebview2/Microsoft.WebView2.FFixedVersionRuntime.102.x.xxx.../for the path valuenpm run tauri:serveExpected behavior
App should start as expected but using the fixed webview2 runtime
Platform and versions
Stack trace
No response
Additional context
Example repo: https://github.com/ksumarine/tauri-dev-webview2runtime-issue