[bug] cargo tauri ios dev. tauri: command not found Command PhaseScriptExecution failed with a nonzero exit code
Describe the bug
when i run: cargo tauri ios dev
...
...
...
/bin/sh -c /Users/mx/Library/Developer/Xcode/DerivedData/chatgpt-gfqldbevlpvvxgeqawqlgyepngis/Build/Intermediates.noindex/chatgpt.build/debug-iphoneos/chatgpt_iOS.build/Script-4AACB566BF22B7233F2E816D.sh
/Users/mx/Library/Developer/Xcode/DerivedData/chatgpt-gfqldbevlpvvxgeqawqlgyepngis/Build/Intermediates.noindex/chatgpt.build/debug-iphoneos/chatgpt_iOS.build/Script-4AACB566BF22B7233F2E816D.sh: line 2: tauri: command not found
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
The following build commands failed: PhaseScriptExecution Build\ Rust\ Code /Users/mx/Library/Developer/Xcode/DerivedData/chatgpt-gfqldbevlpvvxgeqawqlgyepngis/Build/Intermediates.noindex/chatgpt.build/debug-iphoneos/chatgpt_iOS.build/Script-4AACB566BF22B7233F2E816D.sh (in target 'chatgpt_iOS' from project 'chatgpt') (1 failure) Error command ["xcodebuild"] exited with code 65
Reproduction
No response
Expected behavior
No response
Platform and versions
Environment
› OS: Mac OS 12.6.3 X64
› Node.js: 16.18.1
› npm: 8.19.2
› pnpm: 7.29.0
› yarn: 1.22.19
› rustup: 1.25.2
› rustc: 1.68.0
› cargo: 1.68.0
› Rust toolchain: stable-aarch64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 2.0.0-alpha.4
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unexpected character 't' while parsing major version number")', /Users/mx/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-cli-2.0.0-alpha.4/src/info.rs:566:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
› @tauri-apps/api [NPM]: tauri-apps%
Stack trace
No response
Additional context
No response
Hi, are you using nvm or any other node version manager?
Since the script is running on /bin/sh, the environment might not be the same that you are using on your terminal thus the node and node modules it running are probably not the ones you expect.
I hit the same error after installing npm packages using bun. I believe I first used my ancient bun 0.1 to install, the updated my bun to 1.x. Later I realised I was behind on the node version as well (18.x) so I upgraded Node to 20.x. How can I make sure my node packages are installed with the same version as I use to run the app in the simulator? bun used a global cache, so I guess I would first have to clear that cache before doing a fresh package install?
https://bun.sh/docs/install/cache#minimizing-re-downloads
Same issue
we made some recent changes to enhance this, can you tell us the steps you've done to initialize the project (tools, nvm, etc)?
I encountered a similar error in Xcode while using Tauri with Bun. If anyone else is using Bun or NVM, they may experience this issue as well.
I manually modified the build script in Xcode as follows: You can find it under "Build Phase" -> "Build Rust Code."
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
I hope this helps others who run into the same problem! And don't forget to check whether the LTS version is installed on your computer
Are there any updates? My tauri version is 2.2.0
nvm version: 0.40.1
I'm new to tauri (and rust) and I've encountered a similar issue. When compiling with Xcode I get the same problem, but when compiling with the command nom run tauri ios dev everything went through. However I cannot use any rust commands (functions), when I invoke them I get an error "command XX not found".
Any hints?
[✔] Environment
- OS: Mac OS 14.5.0 arm64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.86.0 (05f9846f8 2025-03-31)
✔ cargo: 1.86.0 (adf9b6ad1 2025-02-28)
✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 23.7.0
- pnpm: 10.4.1
- yarn: 1.22.22
- npm: 10.9.2
[-] Packages
- tauri 🦀: 2.5.1
- tauri-build 🦀: 2.2.0
- wry 🦀: 0.51.2
- tao 🦀: 0.33.0
- @tauri-apps/api : 2.5.0
- @tauri-apps/cli : 2.5.0
[-] Plugins
- tauri-plugin-opener 🦀: 2.2.6
- @tauri-apps/plugin-opener : 2.2.6
[-] App
- build-type: bundle
- CSP: default-src 'self' blob: data: media:; script-src 'self' 'unsafe-eval';
- frontendDist: ../build
- devUrl: http://localhost:1420/
- framework: Svelte
- bundler: Vite
[-] iOS
- Developer Teams: ****
@acalatrava That command x not found error should be unrelated to this issue here. How did you register the commands (show us please :P ) and does it work on desktop?
I know it may be a different error but, since I get the same error when trying to build from Xcode, I thought it may be related.
Yes, if I run it on desktop with npm run tauri dev, it works fine. However when running npm run tauri ios dev it does not...
After your comment, I thoroughly checked everything and found the issue: I was registering the commands on main.rs instead of lib.rs as per https://v2.tauri.app/start/migrate/from-tauri-1/... so I followed that guide and now it works fine!
Thank you and sorry for missing it!