Error tauri.conf.json error: Additional properties are not allowed ('app', 'bundle', 'identifier', 'productName', 'version' were unexpected) no tauri v2
Assistant
It seems you're encountering an error with your tauri.conf.json configuration file when building your Tauri application. The error message:
code
Error `tauri.conf.json` error: Additional properties are not allowed ('app', 'bundle', 'identifier', 'productName', 'version' were unexpected)
indicates that the JSON configuration contains properties that are not recognized or allowed according to the expected schema.
Understanding the Error:
Additional Properties Not Allowed: This error suggests that the JSON schema used by Tauri to validate your tauri.conf.json does not recognize the properties 'app', 'bundle', 'identifier', 'productName', and 'version' in their current context.
No Tauri v2: You mentioned "no Tauri v2", implying you're using Tauri version 1.x. The configuration schema might have changed between versions, leading to discrepancies.
Possible Reasons:
Incorrect Configuration Structure: The properties might be placed at the wrong level in the JSON hierarchy.
Outdated or Incorrect Schema: Your tauri.conf.json might be following an outdated schema or one that doesn't match your installed Tauri version.
Version Mismatch: There might be a mismatch between your Tauri CLI version and the Tauri dependencies in your project.
Solution:
To resolve this error, you'll need to ensure your tauri.conf.json file adheres to the correct schema for Tauri v1.x. Here's how:
1. Verify Tauri Version
First, confirm the version of Tauri you are using.
Check your Cargo.toml file for the Tauri dependencies:
toml
[dependencies]
tauri = "1.0"
Check the Tauri CLI version:
bash
tauri --version
Ensure both are aligned to the same major version (v1.x).
2. Update Configuration Structure
Here's a corrected example of how your tauri.conf.json should be structured for Tauri v1.x:
If there's still an issue, you might have a version mismatch with the Tauri CLI.
Uninstall the current Tauri CLI:
bash
cargo uninstall tauri-cli
Install the Tauri CLI version matching v1.x:
bash
cargo install tauri-cli@1.0
8. Delete tauri.conf.json and Regenerate (As Last Resort)
If problems persist:
Rename or delete your existing tauri.conf.json.
Run the Tauri init command to generate a new configuration file:
bash
tauri init
Opt to overwrite existing config if prompted.
Choose the options appropriate for your project.
Note: Be cautious with this step as it may overwrite certain settings.
Summary:
The error arises due to unrecognized properties in your tauri.conf.json.
Align your configuration file with Tauri's expected schema.
Nest properties correctly under "package" and "tauri" keys.
Validate your JSON structure to eliminate syntax errors.
Ensure your Tauri CLI and dependencies are all on the same major version.
If you've updated your configuration and still face issues, please consider sharing the content of your tauri.conf.json (without sensitive information) so we can provide more specific assistance.