woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.28k stars 53 forks source link

The mix setup for Linux might need the cmd as well? #150

Closed bus710 closed 1 month ago

bus710 commented 1 month ago

Thanks for this project, I really enjoying the benefits from both side.

As the title says, I see this error when I execute mix setup to restore my project:

** (Mix) The task "npm" could not be found

According to the installation section of the README.md, I am supposed to put setup: ["deps.get", "ecto.setup", "npm install --prefix assets"],, but I found that it actually requires the cmd to avoid the error, so the actual line had to be setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"],.

I use Debian testing, so I am not sure if this is because of the OS or any other condition that I am not aware of - just sharing.

bus710 commented 1 month ago

https://hexdocs.pm/mix/1.12/Mix.Tasks.Cmd.html

woutdp commented 1 month ago

Hi @bus710 thanks for this! (also thanks for the coffee :))

You might be right about this, this command has been sometimes working, sometimes not for certain users. I'm not a 100% sure about it as I don't have access on all OS's myself.

This PR basically does what you 're suggesting: https://github.com/woutdp/live_svelte/pull/142/files

I need to do some investigation into this before I merge that one but haven't gotten around it. Will do at some point in the near future, especially with Svelte 5 coming up, I might tackle this one at the same time.

bus710 commented 1 month ago

Hope someone can find this conversation is useful to solve their problem from mix setup.

Also here is my humble script to install live_svelte. https://gist.github.com/bus710/9967c776a1d19254fea2741fc44b370f