Describe the bug
When opening the generated Tauri iOS project in Xcode and running the app_iOS target directly, the generated Build Rust Code script cannot find npm when Node.js is installed through NVM.
The same project works correctly when launched through the Tauri CLI:
The issue appears to be caused by the environment/PATH available to Xcode build phases being different from the user's shell environment.
Environment
- macOS: Apple Silicon
- Node.js:
20.19.0
- Node manager: NVM
- Project contains
.nvmrc:
- Tauri: 2.x
- Frontend: React + Vite
- Xcode: 26.x
- iOS SDK: 26.x
Reproduction
- Create or use a Tauri 2 project with an iOS target.
- Use NVM to manage Node.js.
- Add a
.nvmrc file to the project:
- Verify that the project works from the terminal:
nvm use
node -v
npm -v
npm run tauri ios dev
- Open the generated Xcode project:
src-tauri/gen/apple/app.xcodeproj
- Select the
app_iOS target.
- Run the project directly from Xcode.
The generated Build Phase contains a command similar to:
npm run -- tauri ios xcode-script -v \
--platform ${PLATFORM_DISPLAY_NAME:?} \
--sdk-root ${SDKROOT:?} \
--framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" \
--header-search-paths "${HEADER_SEARCH_PATHS:?}" \
--gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" \
--configuration ${CONFIGURATION:?} \
${FORCE_COLOR} \
${ARCHS:?}
Actual behavior
Xcode fails with:
When npm is replaced with the absolute path from NVM:
/Users/<user>/.nvm/versions/node/v20.19.0/bin/npm
the next error is:
env: node: No such file or directory
Adding the Node installation directory to PATH allows the script to find both Node and npm:
export PATH="/Users/<user>/.nvm/versions/node/v20.19.0/bin:$PATH"
This confirms that the main issue is the environment/PATH available to the Xcode build phase.
Expected behavior
The generated Tauri Xcode project should be able to locate the Node.js/npm environment required by the project when building from Xcode.
Ideally, when a project uses:
the generated Xcode build script should be able to use the corresponding Node version, or Tauri should provide a documented and reliable mechanism for configuring the Node/npm executable used by Xcode.
Additional context
The project works correctly when started with:
The problem occurs specifically when the generated project is opened directly in Xcode and the build is initiated there.
A related Tauri issue reports a similar problem with cargo: command not found in the generated Xcode build phase, where replacing the command with an absolute path works around the PATH problem:
#10672
Suggested improvement
Consider making the generated Xcode build phase independent of the user's interactive shell PATH, for example by:
- exposing a configurable Node/npm path;
- resolving the Node version from
.nvmrc;
- generating an environment script for Xcode;
- or using an absolute project-resolved executable path.
Logs
Initial error:
/Users/<user>/Library/Developer/Xcode/DerivedData/.../Script-XXXXXXXX.sh: line 2: npm: command not found
After using the absolute npm path:
env: node: No such file or directory
After adding the NVM Node directory to PATH, the Node/npm problem is resolved and the Tauri Xcode script proceeds further.
Expected outcome
A Tauri iOS project using NVM should be buildable directly from Xcode without manually modifying the generated Build Phase or relying on global PATH configuration.
Reproduction
No response
Expected behavior
No response
Full tauri info output
[✔] Environment
- OS: Mac OS 26.1.0 arm64 (X64)
✔ Xcode Command Line Tools: installed
✔ Xcode: 26.2
✔ rustc: 1.97.1 (8bab26f4f 2026-07-14)
✔ cargo: 1.97.1 (c980f4866 2026-06-30)
✔ rustup: 1.29.0 (28d1352db 2026-03-05)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.19.0
- npm: 10.8.2
[-] Packages
- tauri 🦀: 2.11.5
- tauri-build 🦀: 2.6.3
- wry 🦀: 0.55.1, (outdated, latest: 0.56.1)
- tao 🦀: 0.35.3, (outdated, latest: 0.37.0)
- @tauri-apps/api ⱼₛ: 2.11.1
- @tauri-apps/cli ⱼₛ: 2.11.4
[-] Plugins
- tauri-plugin-log 🦀: 2.9.0, (outdated, latest: 2.9.1)
- @tauri-apps/plugin-log ⱼₛ: not installed!
- tauri-plugin-os 🦀: 2.3.2
- @tauri-apps/plugin-os ⱼₛ: 2.3.2
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../build
- devUrl: http://localhost:3200/
- framework: React
- bundler: Vite
[-] iOS
- Developer Teams: Luis Lara (ID: G4Z678ZWGU)
Stack trace
Additional context
No response
Describe the bug
When opening the generated Tauri iOS project in Xcode and running the
app_iOStarget directly, the generated Build Rust Code script cannot findnpmwhen Node.js is installed through NVM.The same project works correctly when launched through the Tauri CLI:
The issue appears to be caused by the environment/PATH available to Xcode build phases being different from the user's shell environment.
Environment
20.19.0.nvmrc:Reproduction
.nvmrcfile to the project:app_iOStarget.The generated Build Phase contains a command similar to:
Actual behavior
Xcode fails with:
When
npmis replaced with the absolute path from NVM:the next error is:
Adding the Node installation directory to PATH allows the script to find both Node and npm:
This confirms that the main issue is the environment/PATH available to the Xcode build phase.
Expected behavior
The generated Tauri Xcode project should be able to locate the Node.js/npm environment required by the project when building from Xcode.
Ideally, when a project uses:
the generated Xcode build script should be able to use the corresponding Node version, or Tauri should provide a documented and reliable mechanism for configuring the Node/npm executable used by Xcode.
Additional context
The project works correctly when started with:
The problem occurs specifically when the generated project is opened directly in Xcode and the build is initiated there.
A related Tauri issue reports a similar problem with
cargo: command not foundin the generated Xcode build phase, where replacing the command with an absolute path works around the PATH problem:#10672
Suggested improvement
Consider making the generated Xcode build phase independent of the user's interactive shell PATH, for example by:
.nvmrc;Logs
Initial error:
After using the absolute npm path:
After adding the NVM Node directory to PATH, the Node/npm problem is resolved and the Tauri Xcode script proceeds further.
Expected outcome
A Tauri iOS project using NVM should be buildable directly from Xcode without manually modifying the generated Build Phase or relying on global PATH configuration.
Reproduction
No response
Expected behavior
No response
Full
tauri infooutputStack trace
Additional context
No response