tauri: [bug] Blank screen on starting tauri application
Describe the bug
I create a new taur-app with vue scaffolding, but it does not working properly, it shows blank white screen. It seems like https://github.com/tauri-apps/tauri/issues/4638
- All resources(js svg and html)loaded, but application’s body is blank.
And websocket is fine(with ping message).
No error/warning message in console.
All elements exists in the html dom.

- When I drage these elements, It shows below.

- Http server works well.

- I tried to run
cargo buildandcargo build --release, but it seems nothing changed.
Reproduction
- Install any missing dependencies.
sudo apt install libwebkit2gtk-4.0-dev \
build-essential \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
and I did not run sudo apt update
2. Create Tauri app with pnpm create tauri-app, selecting vite+vue scaffolding.
3. In ${MyAppDir}, run pnpm run install;
4. Run pnpm run tauri dev
Expected behavior
Content appears in window.
Platform and versions
pnpm run tauri info
> test@0.0.0 tauri /home/nvidia/yx/test
> tauri "info"
Environment
› OS: Ubuntu 18.04 X64
› Node.js: 18.8.0
› npm: 8.18.0
› pnpm: 7.11.0
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-aarch64-unknown-linux-gnu
Packages
› @tauri-apps/cli [NPM]: 1.0.5
› @tauri-apps/api [NPM]: 1.0.2
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,
App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://127.0.0.1:3000/
› framework: Vue.js
App directory structure
├─ src-tauri
├─ dist
├─ public
├─ node_modules
├─ src
└─ .vscode
package.json
{
"name": "test",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"vue": "^3.2.37",
"@tauri-apps/api": "^1.0.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.1",
"vite": "^3.0.2",
"@tauri-apps/cli": "^1.0.5"
}
}
tauri.conf.json
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devPath": "http://127.0.0.1:3000",
"distDir": "../dist",
"withGlobalTauri": false
},
"package": {
"productName": "test",
"version": "0.0.0"
},
"tauri": {
"allowlist": {
"all": true
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "com.tauri.dev",
"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": "test",
"width": 800
}
]
}
}
Stack trace
No error/warning message.
Additional context
No response
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 17
- Comments: 44 (4 by maintainers)
Commits related to this issue
- add better wayland workaround <https://github.com/tauri-apps/tauri/issues/5143#issuecomment-1311815517> — committed to kasimeka/balatro-mod-manager by kasimeka 2 years ago
Found a workaround that let me launch my application.
The issue is caused by a WebKitGTK bug, tracked here.
The issue is not related to Tauri and can be closed.
set
vite.config.ts#server.host=true, like this@thewh1teagle see my comment here. Tauri cannot do anything to fix this. Luckily, as @Angel-Gonzalez points out, the issue in WebKitGTK seems to be already resolved and we just need to wait for our distros to update though I also suspect that while updating, they might have been switched to Wayland or
nvidia_drm.modesetmight have been set for them, which could be the real reason it works for them now, would be very curious to confirm this.The actual reason it works properly with
WEBKIT_DISABLE_COMPOSITING_MODE=1, specifically is because, as I assume, it runs the WebKit engine in X11 mode, instead of Wayland, which is, at the moment, supported on more systems.Setting
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");first onmain.rsfixes the blank screen issue on start and also fixes the window resize flicker. But it introduces a new issue where it will show a blank white screen for few milliseconds on start. To fix this, you can add"transparent": truein yourtauti.conf.jsonfor the window. This seems to fix the blank screen issue on start as well as page flicker on window resize. Also, if you use SSG framework like Next.js for frontend the static HTML will be loaded immediately into webview. The SPA framework triggering css from javascript might also flash colors for few millis on start. Hope this helps.I’m having the same issue with the release binary, also notice that resize the window will fix the rendering problem. I apply the workaround at run time by adding
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");at the main function. my environment it’s a raspberry pi 5I resolved my app with
export WEBKIT_DISABLE_COMPOSITING_MODE=1. Before I setting that environment, I can’t even open the web-view console.Completed? An env var workaround is not a fix. I think this should stay open until the bug is fixed upstream in WebKit. Or has a WebKit update already been completed elsewhere?
A few days ago the package libwebkit2gtk-4.0-37 was updated to version 2.44.1-1. Since this update, no workaround is needed on my debian bookworm / Raspberry Pi OS. I removed the flag and no issue found. Thanks
@TheRosya’s solution seems to be a kernel parameter, which may be a hard ask for some users - this seems to only effect linux platform, we could check this setting and set the related env variables. Thoughts?
To summarize, so far we have the following possible fixes related to these render issues; export __NV_PRIME_RENDER_OFFLOAD=1 export WEBKIT_DISABLE_COMPOSITING_MODE=1 (kernel param) nvidia_drm.modeset=1
Summarizing symptoms; Blank application window - no objects rendered Blank fonts/Fonts cut off - no fonts rendered Trailing/Clipping - repeating graphical artifacts
I’m noting that on GNOME X11 I need
WEBKIT_DISABLE_COMPOSITING_MODE=1,in GNOME Wayland and XFCE (X11) I don’t need it.That’s the plan but it’s easier said than done. Lots of work for the few maintainers with their very limited time.
Please fix. If enterprise was using this they would lose hundreds of millions of dollars because of this one bug.
WEBKIT_DISABLE_COMPOSITING_MODE=1doesn’t work for me.tauri infoappearance
I found that the HTML element is rendered, but there’s an issue with the CSS. When I disabled the CSS in devtools, the element became visible. I output
window.innerHeightin devtools and got a negative number (Infinity).I’m having this issue. Setting the
WEBKIT_DISABLE_COMPOSITING_MODEto 1 doesn’t help.UPDATE: switched driver to
nouveau, still doesn’t work.When using nVidia drivers on linux the following environment variable must be set to prevent the following errors and blank Tauri window.
export __NV_PRIME_RENDER_OFFLOAD=1
Errors;
I am using XFCE (X11) and I need the workaround to run my app properly.
Mark.
The view is flipped in webkit
but normal in the chromium browser.
Fixed by set env.
FYI, got the same on Steam Deck earlier, WEBKIT_DISABLE_COMPOSITING_MODE=1 fixed as well