tauri2权限报错Permissions associated with this command: os:allow-locale等解决办法

555 阅读1分钟

tauri2为了更加安全的权限策略,将权限单独提出来放到一个capabilities文件夹中了,官方文档:Capabilities for Different Windows and Platforms | Tauri,tauri2项目的目录结构中也会自动有这个文件夹和默认权限:

运行权限报错:

Unhandled Promise Rejection: os.locale not allowed. Permissions associated with this command: os:allow-locale, os:default

http.fetch not allowed. Permissions associated with this command: http:allow-fetch, http:default

Unhandled Promise Rejection: http.fetch not allowed. Permissions associated with this command: http:allow-fetch, http:default

 

说明没有在 capabilities 中defalut.json里面添加权限,将权限添加上去即可:

然后再次运行就没有错误提示了