No route found for GET /assets/app.css (Phoenix 1.7.11)

I am in China, so I just try a new Phoenix project with mix phx.new hello,after this I run command mix setup, and the error:

13:48:38.322 [info] Migrations already up
[debug] Downloading tailwind from https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.0/tailwindcss-macos-x64
** (RuntimeError) Couldn't fetch https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.0/tailwindcss-macos-x64: {:error, :socket_closed_remotely}

This typically means we cannot reach the source or you are behind a proxy.
You can try again later and, if that does not work, you might:

  1. If behind a proxy, ensure your proxy is configured and that
     your certificates are set via the cacerts_path configuration

  2. Manually download the executable from the URL above and
     place it inside "_build/tailwind-macos-x64"

  3. Install and use Tailwind from npmJS. See our module documentation
     to learn more: https://hexdocs.pm/tailwind

I manually download tailwind-macos-x64, put it under _build dir, but when I start with mix phx.server I get No route found for GET /assets/app.css and the UI all mess.

And then I follow Tailwind — tailwind v0.2.2 change config/config.exs file this part:

config :tailwind,
  version: "3.4.0",
  hi: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css
    ),
    cd: Path.expand("../assets", __DIR__)
  ],
  path: "../_build/tailwindcss-macos-x64"

Still not work, anyone can help me?

As far as I know, GitHub is blocked in China, why don’t you use some of the mirrors and download Tailwind’s latest release manually through it?

I manually download tailwindcss-macos-x64 put it inside _build dir, still not work, which is make me confuse :smiling_face_with_tear:

Try using this mix command with the proper URL (must be run from the same directory as your project’s mix.exs file):

mix tailwind.install https://somedomain.com/path/to/tailwind/binary

1 Like

Thank you so much! I solve this by doing:

  1. Download and put tailwindcss-macos-x64 in some directory
  2. Run npm install -g http-server
  3. In the same directory in step 1, run http-server
  4. In Phoenix project run mix tailwind.install http://127.0.0.1:8080/tailwindcss-macos-x64
  5. Then mix phx.server will work.

Also , i found out that manually put tailwindcss-macos-x64 will also work if I do:

  1. Put tailwind-macos-x64 inside _build, not tailwindcss.., the name was wrong.
  2. Run chmod +x _build/tailwind-macos-x64
  3. Also need to give permission in System Preferences -> Security & Privacy
1 Like