tauri icon indicating copy to clipboard operation
tauri copied to clipboard

Unhandled Promise Rejection: TypeError: window.__TAURI_IPC__ is not a function.

Open yuanhaotian opened this issue 1 year ago • 9 comments

Describe the bug

屏幕快照 2024-02-23 下午10 22 52

This is the default code generated and cannot be run.

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 10.14.6 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 18.9.1
    - pnpm: 8.15.3
    - yarn: 1.22.10
    - npm: 8.19.1

[-] Packages
    - tauri [RUST]: 1.6.0
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.7
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.10

[-] 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

yuanhaotian avatar Feb 23 '24 14:02 yuanhaotian

Any update for this problem?

syirilrakhulh avatar Mar 05 '24 11:03 syirilrakhulh

I meet the same problem

ChuTingzj avatar Mar 08 '24 09:03 ChuTingzj

Can you 2 also post the output of the tauri info command please?

FabianLars avatar Mar 08 '24 09:03 FabianLars

截屏2024-03-08 17 40 04

ChuTingzj avatar Mar 08 '24 09:03 ChuTingzj

I am having the same problem. Only __TAURI_INTERNALS__ is available in the main window and the @tauri-apps/api invoke() method is not available.

% bun run tauri info 
$ tauri info

[✔] Environment
    - OS: Mac OS 14.2.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 21.4.0
    - npm: 10.2.4
    - bun: 1.0.18

[-] Packages
    - tauri [RUST]: 2.0.0-beta.10
    - tauri-build [RUST]: 2.0.0-beta.8
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 2.0.0-beta.8

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React (Next.js)
    - bundler: Vite

スクリーンショット 2024-03-09 13 00 19

8beeeaaat avatar Mar 09 '24 04:03 8beeeaaat

@8beeeaaat Your @tauri-apps/api package is outdated. If you update it to v2 beta it should work.

FabianLars avatar Mar 09 '24 10:03 FabianLars

I still can't reproduce this. I even dug out my macos catalina VM to almost match OP's tauri info output but it just works.

Anyone still seeing this, please upload the app that has this issue to github, and describe the exact steps you took that lead to this error.

Also, even though it doesn't seem apply to OP's screenshot, Tauri's ipc only works in actual tauri windows, so if you open your frontend in your normal browser then this error is to be expected...

FabianLars avatar Mar 13 '24 15:03 FabianLars

I still can't reproduce this. I even dug out my macos catalina VM to almost match OP's tauri info output but it just works.

Anyone still seeing this, please upload the app that has this issue to github, and describe the exact steps you took that lead to this error.

Also, even though it doesn't seem apply to OP's screenshot, Tauri's ipc only works in actual tauri windows, so if you open your frontend in your normal browser then this error is to be expected...

I have resolved my problem!

ChuTingzj avatar Mar 15 '24 09:03 ChuTingzj

Uncaught (in promise) TypeError: window.TAURI_IPC is not a function ,这个问题解决了吗?

lienahu9 avatar Jun 13 '24 09:06 lienahu9

I ran into this because I set all my Tauri packages to install the latest tag, but the Tauri @tauri-apps/api package doesn't use latest to mean the 2.0.0 version, and instead requires next to install the 2.0.0 version.

Aeolun avatar Jul 21 '24 13:07 Aeolun

I will close this issue since some people resolved their issues and the others didn't react to my messages. If you're still facing this issue, feel free to keep commenting (ideally with those instructions in mind https://github.com/tauri-apps/tauri/issues/8961#issuecomment-1994607248 ) or open a new issue.

FabianLars avatar Jul 22 '24 11:07 FabianLars

I encountered the same problem and have not solved it. If someone has a solution, could you provide the solution?

kvbops avatar Nov 06 '24 04:11 kvbops

Are you trying to open the app in a browser?

https://stackoverflow.com/a/76083271/487878

harikt avatar Feb 11 '25 14:02 harikt