tauri-apps / tauri-apps/plugins-workspace

[bug] TypeError: undefined is not an object (evaluating 'window.__TAURI_OS_PLUGIN_INTERNALS__.platform')

Open
#3,459 7 comments 0 reactions 0 assignees View on GitHub
plugin: os type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

### Describe the bug

![Image](https://github.com/user-attachments/assets/f99770d1-51f2-48fd-a699-812a9082a2a4)

```tsx
import { platform } from '@tauri-apps/plugin-os';
const platformName = platform();
console.log(11111, platformName)
```

```json
"dependencies": {
"@tauri-apps/api": ">=2.0.0",
"@tauri-apps/plugin-autostart": "~2",
"@tauri-apps/plugin-deep-link": "^2.2.0",
"@tauri-apps/plugin-global-shortcut": "~2.0.0",
"@tauri-apps/plugin-http": "~2.0.1",
"@tauri-apps/plugin-os": "^2.2.0",
"@tauri-apps/plugin-shell": ">=2.0.0",
"@tauri-apps/plugin-websocket": "~2",
"@tauri-apps/plugin-window": "2.0.0-alpha.1",
}
```

Why does this error occur? The project is Tauri2.

### Reproduction

_No response_

### Expected behavior

_No response_

### Full `tauri info` output

```text
[✔] Environment
- OS: Mac OS 14.5.0 x86_64 (X64)
✔ Xcode Command Line Tools: installed
✔ 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-apple-darwin (default)
- node: 20.12.2
- pnpm: 9.3.0
- yarn: 1.22.22
- npm: 8.19.4

[-] Packages
- tauri 🦀: 2.1.1
- tauri-build 🦀: 2.0.3
- wry 🦀: 0.47.2
- tao 🦀: 0.30.8
- @tauri-apps/api : 2.0.2 (outdated, latest: 2.2.0)
- @tauri-apps/cli : 2.0.3 (outdated, latest: 2.2.7)

[-] Plugins
- tauri-plugin-websocket 🦀: 2.2.0
- @tauri-apps/plugin-websocket : 2.0.0 (outdated, latest: 2.2.1)
- tauri-plugin-autostart 🦀: 2.2.0
- @tauri-apps/plugin-autostart : 2.2.0
- tauri-plugin-http 🦀: 2.0.3
- @tauri-apps/plugin-http : 2.0.1 (outdated, latest: 2.3.0)
- tauri-plugin-global-shortcut 🦀: 2.0.1
- @tauri-apps/plugin-global-shortcut : 2.0.0 (outdated, latest: 2.2.0)
- tauri-plugin-fs 🦀: 2.0.3
- @tauri-apps/plugin-fs : not installed!
- tauri-plugin-store 🦀: 2.2.0
- @tauri-apps/plugin-store : not installed!
- tauri-plugin-deep-link 🦀: 2.2.0
- @tauri-apps/plugin-deep-link : 2.2.0
- tauri-plugin-shell 🦀: 2.0.1
- @tauri-apps/plugin-shell : 2.0.0 (outdated, latest: 2.2.0)
- tauri-plugin-single-instance 🦀: 2.2.0
- @tauri-apps/plugin-single-instance : not installed!

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

### Stack trace

```text

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.