tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.98k stars 2.46k forks source link

`npx tauri` doesn't work unless `@tauri/cli` already installed #6690

Closed ErikBjare closed 1 year ago

ErikBjare commented 1 year ago

Describe the problem

I was setting up a CI workflow for https://github.com/ActivityWatch/aw-tauri, and it uses the tauri-action, which ran the command npx tauri build. The workflow was based on the docs, I had only removed the npm install step.

However, that command failed, as it tried to install the deprecated tauri npm package, not @tauri/cli. With errors like ERROR: tauri.conf.json > tauri has unknown property updater +0ms.

Here is the CI job: https://github.com/ActivityWatch/aw-tauri/actions/runs/4678479347/jobs/8287259860

If I'd have run npm install first, it'd pick the right tauri binary from the @tauri/cli package.

Describe the solution you'd like

It would be nice if the old tauri package could somehow be updated to allow for running npx tauri without having first installed @tauri/cli.

Alternatives considered

I suppose updating the old tauri package with a major-semver version bump release that simply depends on @tauri/cli could work, but I'm not sure whether it is the right call.

Additional context

I commented in the following issue about it earlier today, and it was suggested I create a proper issue here: https://github.com/tauri-apps/tauri-action/issues/113#issuecomment-1505211808

And finally, because I have the opportunity: thanks to everyone who's working on Tauri! It looks truly amazing and I'm hyped and likely to adopt it.

amrbashir commented 1 year ago

The workflow was based on the docs, I had only removed the npm install step.

Can you give me a link to this doc page? It needs to be updated if it has any mention of npx

As for updating the tauri package, I don't think it is something we would want to do, we already deprecated the package.

If you want to use @tauri-apps/cli using npx then you need to do npx @tauri-apps/cli build

ErikBjare commented 1 year ago

The docs I followed were: https://tauri.app/v1/guides/building/cross-platform/

And it turns out it uses the tauri-action which in turn uses npx? (I updated the issue to correct that)

I can understand if npm install is necessary before, but the comment in the above docs seemed to suggest it was optional:

- name: Install frontend dependencies
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.

Nvm, I'm dumb. Idk why I read that as "this is optional, tauri action will fix".

So I guess the fault is still mostly with me. Sad to give up on npx tauri not resolving to the correct package if not installed, but I can understand.

amrbashir commented 1 year ago

Looks like the action has been changed to use npm run instead of npx in https://github.com/tauri-apps/tauri-action/pull/387 but hasn't been released, you can use it directly from github by changing https://github.com/ActivityWatch/aw-tauri/blob/master/.github/workflows/release.yml#L46 to uses: tauri-apps/tauri-action@dev

ErikBjare commented 1 year ago

@amrbashir Ah, good find. Looks like it just hasn't been released yet (the v0 tag points back to Aug 2022).