tauri-apps / tauri

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

[bug] tauri commands with arguments failing to invoke on mobile #7766

Closed Dosx001 closed 11 months ago

Dosx001 commented 11 months ago

Describe the bug

A Tauri command with arguments fails to invoke for mobile build on Android.

Reproduction

pnpm create tauri-app test --alpha --mobile --template solid-ts --manager pnpm
cd test
pnpm i
pnpm tauri android init
pnpm tauri android dev

Press the greet button.

Expected behavior

Tauri commands with arguments should work when the correct arguments are given.

Platform and versions

[✔] Environment
    - OS: Arch Linux Rolling Release X64
    ✔ webkit2gtk-4.1: 2.40.5
    ✔ rsvg2: 2.56.3
    ✔ rustc: 1.69.0 (84c898d65 2023-04-16)
    ✔ Cargo: 1.69.0 (6e9a83356 2023-04-12)
    ✔ rustup: 1.26.0 (2023-05-04)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.5.0
    - pnpm: 8.6.12
    - yarn: 1.22.19
    - npm: 9.8.1

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.11
    - tauri-build [RUST]: 2.0.0-alpha.8
    - wry [RUST]: 0.31.1
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.4
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.9

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

Stack trace

09-06 17:51:08.782 11056 11056 E Tauri/Console: File: https://tauri.localhost/src/App.tsx?t=1694047861033 - Line 20 - Msg: Uncaught (in promise) invalid args `name` for command `greet`: command greet missing required key name

Additional context

No response

Dosx001 commented 11 months ago

hmm, I tried updating and restarting my computer but now I can't start the dev server.

> test@0.0.0 tauri /home/dosx/repos/app/test
> tauri "android" "dev"

        Info Using 192.168.50.39 to access the development server.
        Info Detected connected device: Pixel_3a_API_34_extension_level_7_x86_64 (sdk_gphone64_x86_64) with target "x86_64-linux-android"
     Running BeforeDevCommand (`pnpm dev`)

> test@0.0.0 dev /home/dosx/repos/app/test
> vite

failed to load config from /home/dosx/repos/app/test/vite.config.ts
error when starting dev server:
TypeError: Cannot redefine property: File
    at Function.defineProperty (<anonymous>)
    at Object.<anonymous> (/home/dosx/repos/app/test/node_modules/.pnpm/@babel+core@7.22.15/node_modules/@babel/core/lib/index.js:7:8)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/home/dosx/repos/app/test/node_modules/.pnpm/@babel+core@7.22.15/node_modules/@babel/core/lib/config/helpers/config-api.js:16:14)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
 ELIFECYCLE  Command failed with exit code 1.
       Error The "beforeDevCommand" terminated with a non-zero status code.
 ELIFECYCLE  Command failed with exit code 1.
[✔] Environment
    - OS: Arch Linux Rolling Release X64
    ✔ webkit2gtk-4.1: 2.40.5
    ✔ rsvg2: 2.56.3
    ✔ rustc: 1.69.0 (84c898d65 2023-04-16)
    ✔ Cargo: 1.69.0 (6e9a83356 2023-04-12)
    ✔ rustup: 1.26.0 (2023-05-04)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.6.0
    - pnpm: 8.7.4
    - yarn: 1.22.19
    - npm: 9.8.1

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.12
    - tauri-build [RUST]: 2.0.0-alpha.8
    - wry [RUST]: 0.32.0
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.6
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.12

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: SolidJS
    - bundler: Vite
pewsheen commented 11 months ago

For the first issue, it should be fixed after you update your @tauri-apps/api to 2.0.0-alpha.6 in package.json.

amrbashir commented 11 months ago

The second problem is not from tauri so I'd suggest making a minimal issue so we can help you or ask in the vite community.