tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] When the parent directory of the tauri2 project directory is named `[tauri]`, core capabilities are not recognized

Open muyaCode opened this issue 1 year ago • 5 comments

Describe the bug

I rehash the issue and see why: #issues 10335

I created the tauri2 project in the project directory [tauri] with the command pnpm create tauri-app-beta. Here are the steps to reproduce the BUG

I want to use the @tauri-apps/api v2.0.0-beta library and need to add permissions attribute data to the xx.json file in the src-tauri\capabilities directory.

I tried to add the https://v2.tauri.app/zh-cn/reference/javascript/api/ documentation of all Namespaces, as "window:allow-create". and so on

but is the Visual Studio Code editor newspaper warned: "the value is not accepted, valid values: "app:default", "clipboard-manager:default"......” .

Running the project results in an error:

error: failed to run custom build command for `tauri2-demo v0.0.1 (D:\Code\[MyProject]\[Tauri]\tauri2-demo\src-tauri)`

Caused by:
  process didn't exit successfully: `D:\Code\[MyProject]\[Tauri]\tauri2-demo\src-tauri\target\debug\build\tauri2-demo-a9ce0848c2c700c1\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-check-cfg=cfg(desktop)
  cargo:rustc-cfg=desktop
  cargo:rustc-check-cfg=cfg(mobile)
  cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_APP_NAME=build
  cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_PREFIX=com_tauri2_demo_tool
  cargo:rustc-check-cfg=cfg(dev)
  cargo:rustc-cfg=dev
  cargo:PERMISSION_FILES_PATH=D:\Code\[MyProject]\[Tauri]\tauri2-demo\src-tauri\target\x86_64-pc-windows-msvc\debug\build\tauri2-demo-36cf297c41b60ef7\out\app-manifest\__app__-permission-files
  cargo:rerun-if-changed=capabilities
  Permission webview:allow-create-webview not found, expected one of clipboard-manager:allow-clear, clipboard-manager:allow-read-image, clipboard-manager:allow-read-text, clipboard-manager:allow-write-html, clipboard-manager:allow-write-image, clipboard-manager:allow-write-text, clipboard-manager:deny-clear, clipboard-manager:deny-read-image, clipboard-manager:deny-read-text, clipboard-manager:deny-write-html, clipboard-manager:deny-write-image, clipboard-manager:deny-write-text, dialog:allow-ask, dialog:allow-confirm, dialog:allow-message, dialog:allow-open, dialog:allow-save, dialog:deny-ask, dialog:deny-confirm, dialog:deny-message, dialog:deny-open, dialog:deny-save, fs:default, fs:allow-copy-file, fs:allow-create, fs:allow-exists, fs:allow-fstat, fs:allow-ftruncate, fs:allow-lstat, fs:allow-mkdir, fs:allow-open, fs:allow-read, fs:allow-read-dir, fs:allow-read-file, fs:allow-read-text-file, fs:allow-read-text-file-lines, fs:allow-read-text-file-lines-next, fs:allow-remove, fs:allow-rename, fs:allow-seek, fs:allow-stat, fs:allow-truncate, fs:allow-unwatch, fs:allow-watch, fs:allow-write, fs:allow-write-file, fs:allow-write-text-file, fs:deny-copy-file, fs:deny-create, fs:deny-exists, fs:deny-fstat, fs:deny-ftruncate, fs:deny-lstat, fs:deny-mkdir, fs:deny-open, fs:deny-read, fs:deny-read-dir, fs:deny-read-file, fs:deny-read-text-file, fs:deny-read-text-file-lines, fs:deny-read-text-file-lines-next, fs:deny-remove, fs:deny-rename, fs:deny-seek, fs:deny-stat, fs:deny-truncate, fs:deny-unwatch, fs:deny-watch, fs:deny-webview-data-linux, fs:deny-webview-data-windows, fs:deny-write, fs:deny-write-file, fs:deny-write-text-file, fs:read-all, fs:read-dirs, fs:read-files, fs:read-meta, fs:scope, fs:scope-app, fs:scope-app-index, fs:scope-app-recursive, fs:scope-appcache, fs:scope-appcache-index, fs:scope-appcache-recursive, fs:scope-appconfig, fs:scope-appconfig-index, fs:scope-appconfig-recursive, fs:scope-appdata, fs:scope-appdata-index, fs:scope-appdata-recursive, fs:scope-applocaldata, fs:scope-applocaldata-index, fs:scope-applocaldata-recursive, fs:scope-applog, fs:scope-applog-index, fs:scope-applog-recursive, fs:scope-audio, fs:scope-audio-index, fs:scope-audio-recursive, fs:scope-cache, fs:scope-cache-index, fs:scope-cache-recursive, fs:scope-config, fs:scope-config-index, fs:scope-config-recursive, fs:scope-data, fs:scope-data-index, fs:scope-data-recursive, fs:scope-desktop, fs:scope-desktop-index, fs:scope-desktop-recursive, fs:scope-document, fs:scope-document-index, fs:scope-document-recursive, fs:scope-download, fs:scope-download-index, fs:scope-download-recursive, fs:scope-exe, fs:scope-exe-index, fs:scope-exe-recursive, fs:scope-font, fs:scope-font-index, fs:scope-font-recursive, fs:scope-home, fs:scope-home-index, fs:scope-home-recursive, fs:scope-localdata, fs:scope-localdata-index, fs:scope-localdata-recursive, fs:scope-log, fs:scope-log-index, fs:scope-log-recursive, fs:scope-picture, fs:scope-picture-index, fs:scope-picture-recursive, fs:scope-public, fs:scope-public-index, fs:scope-public-recursive, fs:scope-resource, fs:scope-resource-index, fs:scope-resource-recursive, fs:scope-runtime, fs:scope-runtime-index, fs:scope-runtime-recursive, fs:scope-temp, fs:scope-temp-index, fs:scope-temp-recursive, fs:scope-template, fs:scope-template-index, fs:scope-template-recursive, fs:scope-video, fs:scope-video-index, fs:scope-video-recursive, fs:write-all, fs:write-files, fs:allow-app-meta, fs:allow-app-meta-recursive, fs:allow-app-read, fs:allow-app-read-recursive, fs:allow-app-write, fs:allow-app-write-recursive, fs:allow-appcache-meta, fs:allow-appcache-meta-recursive, fs:allow-appcache-read, fs:allow-appcache-read-recursive, fs:allow-appcache-write, fs:allow-appcache-write-recursive, fs:allow-appconfig-meta, fs:allow-appconfig-meta-recursive, fs:allow-appconfig-read, fs:allow-appconfig-read-recursive, fs:allow-appconfig-write, fs:allow-appconfig-write-recursive, fs:allow-appdata-meta, fs:allow-appdata-meta-recursive, fs:allow-appdata-read, fs:allow-appdata-read-recursive, fs:allow-appdata-write, fs:allow-appdata-write-recursive, fs:allow-applocaldata-meta, fs:allow-applocaldata-meta-recursive, fs:allow-applocaldata-read, fs:allow-applocaldata-read-recursive, fs:allow-applocaldata-write, fs:allow-applocaldata-write-recursive, fs:allow-applog-meta, fs:allow-applog-meta-recursive, fs:allow-applog-read, fs:allow-applog-read-recursive, fs:allow-applog-write, fs:allow-applog-write-recursive, fs:allow-audio-meta, fs:allow-audio-meta-recursive, fs:allow-audio-read, fs:allow-audio-read-recursive, fs:allow-audio-write, fs:allow-audio-write-recursive, fs:allow-cache-meta, fs:allow-cache-meta-recursive, fs:allow-cache-read, fs:allow-cache-read-recursive, fs:allow-cache-write, fs:allow-cache-write-recursive, fs:allow-config-meta, fs:allow-config-meta-recursive, fs:allow-config-read, fs:allow-config-read-recursive, fs:allow-config-write, fs:allow-config-write-recursive, fs:allow-data-meta, fs:allow-data-meta-recursive, fs:allow-data-read, fs:allow-data-read-recursive, fs:allow-data-write, fs:allow-data-write-recursive, fs:allow-desktop-meta, fs:allow-desktop-meta-recursive, fs:allow-desktop-read, fs:allow-desktop-read-recursive, fs:allow-desktop-write, fs:allow-desktop-write-recursive, fs:allow-document-meta, fs:allow-document-meta-recursive, fs:allow-document-read, fs:allow-document-read-recursive, fs:allow-document-write, fs:allow-document-write-recursive, fs:allow-download-meta, fs:allow-download-meta-recursive, fs:allow-download-read, fs:allow-download-read-recursive, fs:allow-download-write, fs:allow-download-write-recursive, fs:allow-exe-meta, fs:allow-exe-meta-recursive, fs:allow-exe-read, fs:allow-exe-read-recursive, fs:allow-exe-write, fs:allow-exe-write-recursive, fs:allow-font-meta, fs:allow-font-meta-recursive, fs:allow-font-read, fs:allow-font-read-recursive, fs:allow-font-write, fs:allow-font-write-recursive, fs:allow-home-meta, fs:allow-home-meta-recursive, fs:allow-home-read, fs:allow-home-read-recursive, fs:allow-home-write, fs:allow-home-write-recursive, fs:allow-localdata-meta, fs:allow-localdata-meta-recursive, fs:allow-localdata-read, fs:allow-localdata-read-recursive, fs:allow-localdata-write, fs:allow-localdata-write-recursive, fs:allow-log-meta, fs:allow-log-meta-recursive, fs:allow-log-read, fs:allow-log-read-recursive, fs:allow-log-write, fs:allow-log-write-recursive, fs:allow-picture-meta, fs:allow-picture-meta-recursive, fs:allow-picture-read, fs:allow-picture-read-recursive, fs:allow-picture-write, fs:allow-picture-write-recursive, fs:allow-public-meta, fs:allow-public-meta-recursive, fs:allow-public-read, fs:allow-public-read-recursive, fs:allow-public-write, fs:allow-public-write-recursive, fs:allow-resource-meta, fs:allow-resource-meta-recursive, fs:allow-resource-read, fs:allow-resource-read-recursive, fs:allow-resource-write, fs:allow-resource-write-recursive, fs:allow-runtime-meta, fs:allow-runtime-meta-recursive, fs:allow-runtime-read, fs:allow-runtime-read-recursive, fs:allow-runtime-write, fs:allow-runtime-write-recursive, fs:allow-temp-meta, fs:allow-temp-meta-recursive, fs:allow-temp-read, fs:allow-temp-read-recursive, fs:allow-temp-write, fs:allow-temp-write-recursive, fs:allow-template-meta, fs:allow-template-meta-recursive, fs:allow-template-read, fs:allow-template-read-recursive, fs:allow-template-write, fs:allow-template-write-recursive, fs:allow-video-meta, fs:allow-video-meta-recursive, fs:allow-video-read, fs:allow-video-read-recursive, fs:allow-video-write, fs:allow-video-write-recursive, fs:deny-default, http:default, http:allow-fetch, http:allow-fetch-cancel, http:allow-fetch-read-body, http:allow-fetch-send, http:deny-fetch, http:deny-fetch-cancel, http:deny-fetch-read-body, http:deny-fetch-send, os:allow-arch, os:allow-exe-extension, os:allow-family, os:allow-hostname, os:allow-locale, os:allow-os-type, os:allow-platform, os:allow-version, os:deny-arch, os:deny-exe-extension, os:deny-family, os:deny-hostname, os:deny-locale, os:deny-os-type, os:deny-platform, os:deny-version, process:allow-exit, process:allow-restart, process:deny-exit, process:deny-restart, shell:allow-execute, shell:allow-kill, shell:allow-open, shell:allow-spawn, shell:allow-stdin-write, shell:deny-execute, shell:deny-kill, shell:deny-open, shell:deny-spawn, shell:deny-stdin-write
 ELIFECYCLE  Command failed with exit code 4294967295.
 ELIFECYCLE  Command failed with exit code 101.

   

Reproduction

I created the tauri2 project in the project directory [tauri] with the command pnpm create tauri-app-beta

Expected behavior

document: The Namespaces in https://v2.tauri.app/zh-cn/reference/javascript/api/ It can be defined normally in the "permissions" field in the tauri2\src-tauri\capabilities\default.json file

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 126.0.2592.113
    ✔ MSVC: 
        - Visual Studio Community 2022
        - Visual Studio 生成工具 2022
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.12.2
    - pnpm: 9.5.0
    - yarn: 1.22.22
    - npm: 10.5.0
    - bun: 1.1.12

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api [NPM]: 2.0.0-beta.15
    - @tauri-apps/cli [NPM]: 2.0.0-beta.22

[-] App
    - build-type: bundle
    - CSP: style-src 'unsafe-inline' 'self'; object-src 'self'; img-src 'self' asset: http://asset.localhost blob: data:; media-src stream: http://stream.localhost;; default-src 'self' customprotocol: asset: data:; connect-src ipc: http://ipc.localhost  'self' https://api.iconify.design; font-src https://fonts.gstatic.com
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

muyaCode avatar Jul 21 '24 09:07 muyaCode

Can you please post the full output of tauri info? We must see the exact tauri version you're using. Maybe also try deleting the ~/.cargo/registry/ directory and then create a new app 🤔

FabianLars avatar Jul 22 '24 11:07 FabianLars

@FabianLars "@tauri apps/API" : > = 2.0.0-beta.15 and @ "tauri apps/cli" :" 2.0.0-beta.22 "Both dependencies are the latest version

Visual Studio Code editor alerts and running project errors, both of which I have mentioned here:#10335

The tauri2 project can be replicated by using the command pnpm create tauri-app-beta in the project directory "[tauri]"

After I tried moving the project out of the directory "[tauri]" and then removing the directories: node_modules, src-tauri\gen, and src-tauri\target, installing the project dependencies again seemed to work, so I guessed it was a matter of building the project in "[tauri]"

muyaCode avatar Jul 22 '24 13:07 muyaCode

The tauri2 project can be replicated by using the command pnpm create tauri-app-beta in the project directory "[tauri]"

Ahh, now i get it! I was a bit dense, sorry.

FabianLars avatar Jul 22 '24 13:07 FabianLars

@FabianLars "@tauri apps/API" : > = 2.0.0-beta.15 and @ "tauri apps/cli" :" 2.0.0-beta.22 "Both dependencies are the latest version

Visual Studio Code editor alerts and running project errors, both of which I have mentioned here:#10335

The tauri2 project can be replicated by using the command pnpm create tauri-app-beta in the project directory "[tauri]"

After I tried moving the project out of the directory "[tauri]" and then removing the directories: node_modules, src-tauri\gen, and src-tauri\target, installing the project dependencies again seemed to work, so I guessed it was a matter of building the project in "[tauri]"

I have the exact same issue after I try to migrate to 2.0. I tried to remove npm modules, cargo clean, and rebuild but it's not solved my problem :(

altunenes avatar Aug 15 '24 14:08 altunenes

fixed: I just ran my cmd in admin mode and it's fixed lol.

cd ui delete all npm packages, cargo clean, reverse everything. open cmd again in admin mode cd app migrate tauri cd ui npm i cargo build npm run tauri dev. fixed...

altunenes avatar Aug 15 '24 20:08 altunenes

I can't reproduce this one, can you share a repo to reproduce it? also might be worth trying on latest v2 stable maybe this was caused by an older cache so probably deleting the src-tauri/target folder fixed it

lucasfernog avatar Nov 08 '24 11:11 lucasfernog