[docs] There are serious mistakes and missing parts
Describe the bug
I don't know why the error was reported
Reproduction
Partial code:
VUE:
import { open } from '@tauri-apps/plugin-shell';
(.....)
const openBrowser_contract_2 = async () => {
await open('https://www.google.com/');
}
src-tauri\capabilities\default.json:
{
(......)
"tauri": {
"allowlist": {
"shell": {
"all": true,
"open": true,
"execute": true,
"sidecar": true,
"scope": [
{"url":"https://**"},
},
"fs": {
(......)
]
}
}
},
"permissions": [
"core:default",
"shell:allow-open",
"shell:allow-execute",
"shell:allow-kill",
"shell:allow-spawn",
"shell:allow-stdin-write",
"shell:default"
]
}
src-tauri\tauri.conf.json:
{
(......)
"app": {
"windows": [(......)]
},
"plugins": {
"shell": {
"open": true
}
}
}
}
An exception occurred after running await open('https://www.google.com/'); -> plugin shell not found
The installation commands I have run:
npm install @tauri-apps/plugin-shell
cargo add tauri-plugin-shell
Expected behavior
No response
Full tauri info output
PS D:\User\Documents\T> npm run tauri info
> [email protected] tauri
> tauri info
[✔] Environment
- OS: Windows 10.0.20348 x86_64 (X64)
✔ WebView2: 135.0.3179.98
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.85.1 (4eb161250 2025-03-15)
✔ cargo: 1.85.1 (d73d2caf9 2024-12-31)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.14.0
- yarn: 1.22.22
- npm: 11.0.0
[-] Packages
- tauri 🦀: 2.4.1, (outdated, latest: 2.5.1)
- tauri-build 🦀: 2.1.1, (outdated, latest: 2.2.0)
- wry 🦀: 0.50.5, (outdated, latest: 0.51.2)
- tao 🦀: 0.32.8, (outdated, latest: 0.33.0)
- @tauri-apps/api : 2.5.0
- @tauri-apps/cli : 2.5.0
[-] Plugins
- tauri-plugin-os 🦀: 2.2.1
- @tauri-apps/plugin-os : 2.2.1
- tauri-plugin-opener 🦀: 2.2.6
- @tauri-apps/plugin-opener : 2.2.6
- tauri-plugin-shell 🦀: 2.2.1
- @tauri-apps/plugin-shell : 2.2.1
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Vue.js
- bundler: Vite
Stack trace
Additional context
No response
Solved. The reason is that I didn't see
Usage
First you need to register the core plugin with Tauri:
src-tauri/src/lib.rs
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
in https://crates.io/crates/tauri-plugin-shell.
There are major problems with your documents. A lot of things are missing For example, in the plugins, you didn't tell me the installation commands and initialization commands for each plugin
It's hard for me to imagine what a project with 92K could achieve: You directly copied the documentation of tauri1 into tauri2 without even making any modifications. How careless are you For example: https://tauri.app/reference/javascript/shell/#open
Lack of examples and initialization code: https://tauri.app/reference/javascript/shell/#security
The document is too abstract!!
https://tauri.app/reference/javascript/shell/
Just note that this is the reference page, the main guide is at https://tauri.app/plugin/shell/ which does have an initialization example
~~We should update the outdated reference docs though~~ Actually, does tauri.conf.json > plugins > shell > open not work?
https://tauri.app/reference/javascript/shell/
Just note that this is the reference page, the main guide is at https://tauri.app/plugin/shell/ which does have an initialization example
I personally recommend linking the two pages, I've always only looked at the JS page, because I'm not going to deal with this on the rust side. So I've been doing this on the front end, and personally I think it's something that can easily be overlooked
I personally recommend linking the two pages, I've always only looked at the JS page, because I'm not going to deal with this on the rust side. So I've been doing this on the front end, and personally I think it's something that can easily be overlooked
I wonder how did you end up being on that page, since we didn't link it anywhere except in https://tauri.app/plugin/shell/
This is also the case in the top search results
我个人建议将这两个页面关联起来,我一直只关注 JS 页面,因为我不会在 Rust 端处理这个问题。所以我一直在前端做这件事,我个人认为这很容易被忽略。
我想知道你是怎么进入这个页面的,因为我们除了https://tauri.app/plugin/shell/之外没有链接到任何地方。
热门搜索结果也存在这种情况
https://tauri.app/ --> https://tauri.app/start/ --> (Referents) -> https://tauri.app/reference/javascript/
Since your rust and js tutorials are separate, I think when writing this part of the code in js, you must go to the js section to look at it. I never thought you would write this kind of thing into the rust section
Since your rust and js tutorials are separate
Hmm, I don't think they're on separate pages, all the plugin tutorial pages contain both the js and rust usage notes (it even shows the js usage first or by default)
由于你的 Rust 和 JS 教程是分开的
嗯,我不认为它们在单独的页面上,所有插件教程页面都包含 js 和 rust 使用说明
Moreover, I haven't found your instructions for using "Plugins". For instance, it doesn't clearly state that one should first look at the content in https://tauri.app/plugin/shell/
(Perhaps I didn't see it?)
I'm not entirely sure I get what you mean, how should we state that? Do you mean we state that in the reference page? Since reference pages are only meant to be used to look up specific APIs, I don't think it's supposed to be looked at when you first getting started with it