-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Tauri #20738
Comments
Any update? |
I'm in a Tauri setup with a SvelteKit frontend. Deno is panicking with this backtrace.
Deno v1.43.6 |
I upgraded to Deno 1.44 to assess if it was feasible for me to use deno for tauri now, because this is one of the tickets relying on binaries and hoped this would help: this is what I get ➜ DENO_FUTURE=1 deno install npm:tauri
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
Add tauri - npm:tauri@^0.15.0
error: Can't set up 'vite' bin at ../.deno/vite@5.2.11/node_modules/vite/bin/vite.js
Caused by:
File exists (os error 17) and ➜ DENO_FUTURE=1 deno run npm:tauri dev
error: '/Users/admin/repos/deno-kitchensink/create-tauri-app/node_modules/.deno/tauri@0.15.0/node_modules/tauri/package.json' did not have a bin property |
With the binary install resolved, this seems to mainly be a matter of confusion/mess with the DENO_FUTURE=1 and the npm:tauri. For instance, the package scripts has an entry called |
For Deno 2 rc.2 + Tauri 1, things run as expected, except the "Greet" button in the demo, it'll give this console error: @tauri-apps_api_tauri.js?v=152d049d:30 Uncaught (in promise) TypeError: window.__TAURI_IPC__ is not a function
at @tauri-apps_api_tauri.js?v=152d049d:30:12
at new Promise (<anonymous>)
at invoke (@tauri-apps_api_tauri.js?v=152d049d:21:10)
at greet (main.ts:9:36)
at HTMLFormElement.<anonymous> (main.ts:20:5) |
Trying Tauri 2 rc |
With deno2 rc + tauri2 rc: Note: For creation npm is needed, because of cli issues passing --rc flag to deno run: npm create tauri-app@latest -- --rc
deno install
deno task dev Error in console @tauri-apps_api_core.js?v=1934d98c:89 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'invoke')
at invoke (@tauri-apps_api_core.js?v=1934d98c:89:37)
at greet (App.tsx:12:23)
at HTMLFormElement.<anonymous> (App.tsx:37:11) |
Does it work now? Sounds like tauri apps is not deno compatible from the error message. The rust bindings is probably specific to node. What are the benefits of using deno for this? Can I still use pnpm as the package manager? |
I use it just fine. There are no Rust bindings in Tauri (apart from the CLI), it is all IPC.
You can see the benefits of Deno on its website. You shouldn't use pnpm with Deno. |
@ninjadev64 how is it working for u?
For me |
The only way I see to make I've never tried building the app yet, so not sure if above custom script will be sufficient to make things work with Tauri builds. |
In my package.json I have the normal vite dev, build and preview scripts. In my tauri.conf.json I have the beforeDevCommand or whatever it is as |
Thanks for sharing. No worries, I found a solution somewhere in the tauri issues. We first need to install Following steps works for me: cargo install create-tauri-app tauri-cli --locked
cargo create-tauri-app foo
cd foo
deno install
# Ensure u update tauri.conf.json to use deno commands, i.e.
# change to the following:
# "beforeDevCommand": "deno task dev",
# "beforeBuildCommand": "deno task build",
# and then run the following command
cargo tauri dev # from repo's root directory. |
I believe this issue can be closed. |
@ninjadev64 , when I made this ticket, it was all Tauri 1 + Deno 1. Now both Tauri and Deno are stable in v2, and I think there is still a few tweaks needed, but let's focus on ensuring that this forward-looking combination works. |
* feat: add deno support ref: denoland/deno#20738 * Update packages_nodejs.rs * typo --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
* feat(cli): add deno support ref: denoland/deno#20738 * Update packages_nodejs.rs * typo --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
I gave Tauri 2 + Deno 2 a try: There's a Linting does not seem to work out of the box despite there's {
"compilerOptions": {
"lib": [
"ES2021",
"DOM",
"DOM.Iterable"
]
}
} Deno specific features won't work. For example // https://docs.deno.com/runtime/fundamentals/node/#using-npm-packages
import * as emoji from "npm:node-emoji";
console.log(emoji.emojify(`:sauropod: :heart: npm`)); will result in an error. Edit: turns out what is needed is simply
So to make the tauri template fell more like a deno 2 project: cd tauri-app
rm package.json tsconfig.json
touch deno.jsonc deno.jsonc: {
"nodeModulesDir": "auto",
"tasks": {
"dev": "deno run -A npm:vite",
"build": "deno check src/main.ts && deno run -A npm:vite build",
"preview": "deno run -A npm:vite preview",
"tauri": "deno run -A npm:@tauri-apps/cli"
},
"compilerOptions": {
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
]
},
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0",
"vite": "npm:vite@^5.3",
"@tauri-apps/api": "npm:@tauri-apps/api@^2",
"@tauri-apps/plugin-shell": "npm:@tauri-apps/plugin-shell@^2",
"@tauri-apps/cli": "npm:@tauri-apps/cli@^2"
}
} In import deno from '@deno/vite-plugin';
// ...
export default defineConfig(async () => ({
// ...
plugins: [deno()],
})); Finally: deno install
deno task tauri dev 🥳 |
@xiaoas , awesome, sounds like the deno template just need a few tweaks! |
I was also able to get it working. Here is my example repository. https://github.com/raine-works/tauri-deno/tree/master |
Im new to all of this so i wanna ask, by implementing this you essentially are replacing rust with deno for backend? |
Tauri does not include nodejs as backend or any js backend. If you need backend service need to use with sidecar. there is attempt to run deno with tauri without nodejs. but this tauri-cc project is bridging tauri and deno by ipc connection. so deno cores needs to be modified. other solution is available, run deno compiled js backend as tauri sidecar. i have made working example, here. |
Tauri - Website - GitHub
Platform
Darwin 23.0.0 arm64 arm
Version
deno 1.37.1
Repro
deno run -A npm:create-tauri-app
deno run -A npm:tauri dev
Expected
I.e.
npx tauri dev
gives:Actual
The text was updated successfully, but these errors were encountered: