Installation ​
Getting Nuxt Tauri up and running in your project is straightforward. Follow these steps to install and configure the module.
Prerequisites ​
Ensure you have the following installed:
- Node.js 18 or higher
- pnpm, npm, or yarn package manager
- Nuxt 3 project
- Tauri setup in your project
Install the Module ​
Add the Nuxt Tauri module to your project:
bash
npx nuxi module add nuxt-module-tauribash
npx nuxi module add nuxt-module-tauribash
npx nuxi module add nuxt-module-tauriInstall Tauri API ​
Install the Tauri API peer dependency:
bash
pnpm add @tauri-apps/apibash
npm install @tauri-apps/apibash
yarn add @tauri-apps/apiManual Installation (Alternative) ​
If you prefer to install manually:
- Install the package:
bash
pnpm add nuxt-module-tauribash
npm install nuxt-module-tauribash
yarn add nuxt-module-tauri- Add the module to your
nuxt.config.ts:
typescript
export default defineNuxtConfig({
modules: ["nuxt-module-tauri"],
});Verify Installation ​
Create a simple test to verify the installation:
vue
<template>
<div>
<h1>Nuxt Tauri Test</h1>
<button @click="execute">Test Tauri Connection</button>
<p v-if="pending">Loading...</p>
<p v-if="error">Error: {{ error.message }}</p>
<p v-if="data">Success! {{ data }}</p>
</div>
</template>
<script setup>
// This will be auto-imported
const { data, pending, error, execute } = useTauriInvoke("test_command");
</script>Next Steps ​
Troubleshooting ​
Module not found ​
If you encounter module resolution issues, try:
- Restart your development server
- Clear Nuxt cache:
rm -rf .nuxt - Reinstall dependencies
TypeScript errors ​
Make sure you have the latest version of @tauri-apps/api installed and restart your TypeScript server.