tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.77k stars 2.45k forks source link

[bug] window.__TAURI_INTERNALS__ is undefined #8369

Closed kitty-eu-org closed 9 months ago

kitty-eu-org commented 9 months ago

Describe the bug

When I call the invoke imperative, I get an error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'invoke')

then i run window.__TAURI_INTERNALS__ in brower console is undefined image

Reproduction

No response

Expected behavior

No response

Platform and versions

pnpm run tauri info:

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.1: 2.42.2
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.74.0 (79e9716c9 2023-11-13)
    ✔ cargo: 1.74.0 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 18.14.0
    - pnpm: 8.12.0
    - npm: 9.3.1

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.18
    - tauri-build [RUST]: 2.0.0-alpha.12
    - wry [RUST]: 0.34.2
    - tao [RUST]: 0.23.0
    - @tauri-apps/api [NPM]: 2.0.0-alpha.12
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.18

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

amrbashir commented 9 months ago

invoke is a tauri API, so it is only available in tauri window, you can't use it in a browser.

kitty-eu-org commented 9 months ago

invoke is a tauri API, so it is only available in tauri window, you can't use it in a browser.

how to use invoke in browse, i want use invoke in browser. thanks