tauri: Cannot run a new app on Windows
Describe the bug
A clear and concise description of what the bug is. This is probably the same thing happening in #2867
To Reproduce
Steps to reproduce the behavior: TLDR; follow the tauri website
- Run
yarn create tauri-app cd tauri-app(or whatever you called it)- Run
yarn tauri info - Run
yarn tauri dev<- errors - Try it again⦠fails again
Expected behavior
Tauri app compiles & runs
Platform and Versions (required):
tauri-app> yarn tauri info
yarn run v1.22.17
$ tauri info
app:spawn Running "C:\...\tauri-app\node_modules\@tauri-apps\cli\bin\tauri-cli.exe tauri info" +0ms
Operating System - Windows, version 10.0.19042 X64
Webview2 - 95.0.1020.44
Node.js environment
Node.js - 16.13.0
@tauri-apps/cli - 1.0.0-beta.10
@tauri-apps/api - 1.0.0-beta.8
Global packages
npm - 8.1.2
yarn - 1.22.17
Rust environment
rustc - 1.56.1
cargo - 1.56.0
App directory structure
/.vscode
/node_modules
/public
/src
/src-tauri
App
tauri.rs - 1.0.0-beta.8 (no lockfile)
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - ../public
devPath - http://localhost:5000
framework - Svelte
bundler - Rollup
Done in 10.38s.
Additional context
Fresh install
Stack Trace
> yarn tauri dev
yarn run v1.22.17
$ tauri dev
app:spawn Running "C:\...\tauri-app\node_modules\@tauri-apps\cli\bin\tauri-cli.exe tauri dev" +0ms
[tauri:dev] Running `npm run dev`
> tauri-app@1.0.0 dev
> rollup -c -w
Updating crates.io index
rollup v2.59.0
bundles src/main.ts β public\build\bundle.js...
LiveReload enabled
created public\build\bundle.js in 1.4s
[2021-11-10 12:04:44] waiting for changes...
> tauri-app@1.0.0 start
> sirv public --no-clear "--dev"
Your application is ready~! π
β‘ Port 5000 is taken; using 61291 instead
- Local: http://localhost:61291
- Network: Add `--host` to expose
ββββββββββββββββββ LOGS ββββββββββββββββββ
Compiling cfg-if v1.0.0
Compiling proc-macro2 v1.0.32
Compiling unicode-xid v0.2.2
...snip...
Compiling tauri-utils v1.0.0-beta.3
Compiling tauri-build v1.0.0-beta.4
Compiling tauri-codegen v1.0.0-beta.4
Compiling tauri-runtime v0.2.1
Compiling tauri-runtime-wry v0.2.1
Compiling app v0.1.0 (C:\...\tauri-app\src-tauri)
Compiling tauri-macros v1.0.0-beta.5
error: failed to run custom build command for `app v0.1.0 (C:\...\tauri-app\src-tauri)`
Caused by:
process didn't exit successfully: `C:\...\tauri-app\src-tauri\target\debug\build\app-2b5a73ef3a83e3f7\build-script-build` (exit code: 101)
--- stdout
package.metadata does not exist
Selected RC path: 'bin\x64\rc.exe'
--- stderr
thread 'main' panicked at 'error found during tauri-build: failed to compile `icons/icon.ico` into a Windows Resource file during tauri-build', C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-build-1.0.0-beta.4\src\lib.rs:88:5
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\/library\std\src\panicking.rs:517
1: std::panicking::begin_panic_fmt
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\/library\std\src\panicking.rs:460
2: tauri_build::build
at C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-build-1.0.0-beta.4\src\lib.rs:88
3: build_script_build::main
at .\src\build.rs:2
4: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
Try 2:
> yarn tauri dev
yarn run v1.22.17
$ tauri dev
app:spawn Running "C:\...\tauri-app\node_modules\@tauri-apps\cli\bin\tauri-cli.exe tauri dev" +0ms
[tauri:dev] Running `npm run dev`
> tauri-app@1.0.0 dev
> rollup -c -w
Compiling app v0.1.0 (C:\...\tauri-app\src-tauri)
error: failed to run custom build command for `app v0.1.0 (C:\...\tauri-app\src-tauri)`
Caused by:
process didn't exit successfully: `C:\...\tauri-app\src-tauri\target\debug\build\app-2b5a73ef3a83e3f7\build-script-build` (exit code: 101)
--- stdout
package.metadata does not exist
Selected RC path: 'bin\x64\rc.exe'
--- stderr
thread 'main' panicked at 'error found during tauri-build: failed to compile `icons/icon.ico` into a Windows Resource file during tauri-build', C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-build-1.0.0-beta.4\src\lib.rs:88:5
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\/library\std\src\panicking.rs:517
1: std::panicking::begin_panic_fmt
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\/library\std\src\panicking.rs:460
2: tauri_build::build
at C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-build-1.0.0-beta.4\src\lib.rs:88
3: build_script_build::main
at .\src\build.rs:2
4: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
rollup v2.59.0
bundles src/main.ts β public\build\bundle.js...
LiveReload enabled
created public\build\bundle.js in 1.3s
[2021-11-10 12:18:23] waiting for changes...
> tauri-app@1.0.0 start
> sirv public --no-clear "--dev"
Your application is ready~! π
β‘ Port 5000 is taken; using 54591 instead
- Local: http://localhost:54591
- Network: Add `--host` to expose
ββββββββββββββββββ LOGS ββββββββββββββββββ
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 29 (17 by maintainers)
Commits related to this issue
- docs(setup): mention Windows SDK requirement, closes #2871 — committed to tauri-apps/tauri by lucasfernog 3 years ago
- fix(tauri-build): allow user to specify win sdk path (fix: #2871) (#2893) Co-authored-by: Lucas Nogueira <lucas@tauri.studio> — committed to tauri-apps/tauri by SyntaxRules 3 years ago
- docs(setup): mention Windows SDK requirement, closes #2871 (#2884) — committed to tauri-apps/tauri by lucasfernog 3 years ago
- fix issue with tauri build on win w/o reg access see https://github.com/tauri-apps/tauri/issues/2871 the hard codes path to the win sdk can be overwritten via feature flags - win_sdk_ver to overwrit... — committed to Cielquan/RUlaub by Cielquan 3 years ago
- fix issue with tauri build on win w/o reg access see https://github.com/tauri-apps/tauri/issues/2871 the hard codes path to the win sdk can be overwritten via feature flags - win_sdk_ver to overwrit... — committed to Cielquan/RUlaub by Cielquan 3 years ago
Root cause
The error is produced by an incorrect RC path (like @lucasfernog suggested). The
winrescrate returns a default path,bin\x64\rc.exewhen it cannot determine a real location. In my case, a real location could not be determined because company IT security has restricted registry viewing. Said differentlywinrescannot read my registry keyHKLM\SOFTWARE\Microsoft\Windows Kits\Installed Rootsso it defaults tobin/x64/rc.exe. This is not the correct path.The Solution
If I edit how Iβm calling
winresto below, then things start working:I verified this by running a hard-coded version of tauri-build that had this path in it.
The two fixes i propose are:
winresprobably needs a warning if the path isnβt found and it is using defaultstauri-buildneeds a new config parameter to allow me to pass in the right rc path.Iβll get to work on these PRs right away.
Do I really have a config issue? Looks good to me, no?!
Iβm getting this error and I donβt know how to fix it. I donβt know how to apply the above fix as I am new to Rust/Tauri.