tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] [v2] [android] [windows] Nuxt.js based android app - Cannot redefine property & tauri.localhost

Open georgiai1 opened this issue 1 year ago • 5 comments

Describe the bug

The result is an android emulator with white screen and few errors, the desktop app is working correctly

11-18 01:50:55.088 20184 20184 E Tauri/Console: File: - Line 138 - Msg: Uncaught TypeError: Cannot redefine property: postMessage 11-18 01:50:55.088 20184 20184 E Tauri/Console: File: - Line 2 - Msg: Uncaught TypeError: Cannot redefine property: metadata 11-18 01:50:55.089 20184 20184 E Tauri/Console: File: - Line 25 - Msg: Uncaught TypeError: Cannot redefine property: TAURI_PATTERN 11-18 01:50:55.089 20184 20184 E Tauri/Console: File: - Line 5 - Msg: Uncaught TypeError: Cannot redefine property: path

Also I found out that on the android device the tauri.localhost URL is not working with nuxt and returning 500, as the URLs resources are loaded from are incorrect and inputting manually the localhost:3000 moves us further into the process.

Reproduction

https://github.com/gkkirilov/mobile-test

Clone npm install npx tauri android dev

Open web inspector for android from chrome://inspect/#devices change the URL to localhost:3000 See errors in console

Expected behavior

To show the content of the app on the android emulator

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 130.0.2849.80
    ✔ MSVC: 
        - Visual Studio Build Tools 2017
        - Visual Studio Build Tools 2019
        - Visual Studio Build Tools 2022
        - Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.1
    - yarn: 1.22.21
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 2.1.0
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-log 🦀: 2.0.2
    - @tauri-apps/plugin-log : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:3000/
    - framework: Vue.js (Nuxt)
    - bundler: Webpack

Stack trace

No response

Additional context

Will test on a Mac in the next hour to see if the result is the same

georgiai1 avatar Nov 18 '24 08:11 georgiai1

Just so the team doesn't close this, we're aware that the redefine errors likely come from https://github.com/tauri-apps/wry/pull/1418 not being released yet. This shouldn't cause a white screen though and is also irrelevant to the url thing.

FabianLars avatar Nov 18 '24 11:11 FabianLars

similar-ish issue: https://discord.com/channels/616186924390023171/1330913348572676178

FabianLars avatar Jan 31 '25 20:01 FabianLars

Any update on this ? I tried with withGlobalTauri: false and it still breaks my app.

For some reason those errors are cancelling my

Image

Vexcited avatar Jun 09 '25 22:06 Vexcited

@Vexcited Are you sure this issue broke your app? I don't find a direct relation in the commit that closed your issue. We see the same console errors, but it doesn't break the app.

ahirner avatar Dec 05 '25 04:12 ahirner

Well it was the only related issue to me since when I don't have this log, the api.js file can load and everything works as expected.

I'm debugging in release mode and it seems to work there

Vexcited avatar Dec 05 '25 05:12 Vexcited