examples icon indicating copy to clipboard operation
examples copied to clipboard

Using template as specified does not seem to work

Open kjprice opened this issue 1 year ago • 4 comments

tl;dr can we please update the readme to have template instructions that will work for an impatient noob?

Hello!

I'm new to remix and love it!

The examples are great but I had a tough time using one of the examples as a template.

Problem

In the readme I followed the instructions:

You can also initialize a new project with any of these examples using the --template flag of the create-remix CLI.

And used the example npx create-remix@latest --template examples/<example-dir>

Running this on my own, to use the socket.io example, I ran the following command:

npx create-remix@latest --template examples/socket.io

However, I received the following error:

🚨 Invalid template selected. Please try again.

Solution

After reviewing the docs related to templates I experimented with a few possibilities.

These did not work for me:

npx create-remix@latest --template examples/main/socket.io
npx create-remix@latest --template remix-run/examples/blob/main/socket.io
npx create-remix@latest --template remix-run/examples/socket.io

Finally, using the full github path, this did work for me:

npx create-remix@latest --template https://github.com/remix-run/examples/tree/main/socket.io

My solution I believe is overly verbose than necessary, but if we can update the readme to have an example that will definitely run that would be great.

Thanks again for an amazing product!

kjprice avatar Jun 16 '23 18:06 kjprice

I guess this is because of the . in the folder name as doing npx create-remix@latest --template examples/tailwindcss just works as expected

MichaelDeBoey avatar Jun 16 '23 20:06 MichaelDeBoey

I guess this is because of the . in the folder name as doing npx create-remix@latest --template examples/tailwindcss just works as expected

Well, I tried it and it doesn't work for me, errors with: Oh no! There was a problem fetching the file from GitHub. The request responded with a 404 status. Please try again later.

But workaround using full repository name worked: npx create-remix@latest --template https://github.com/remix-run/examples/tree/main/tailwindcss.

lasas avatar Nov 22 '23 12:11 lasas

Well, I tried it and it doesn't work for me, errors with: Oh no! There was a problem fetching the file from GitHub. The request responded with a 404 status. Please try again later.

But workaround using full repository name worked: npx create-remix@latest --template https://github.com/remix-run/examples/tree/main/tailwindcss.

I experience the same thing. Seems it has not been fixed yet.

sivert-io avatar Jan 07 '24 18:01 sivert-io

Well, I tried it and it doesn't work for me, errors with: Oh no! There was a problem fetching the file from GitHub. The request responded with a 404 status. Please try again later.

For this error, try adding remix-run/ to the front of the template parameter. The docs use a remix-run/examples/<example-dir> format but the README uses a examples/<example-dir> format. I opened a PR to update the README: https://github.com/remix-run/examples/pull/435

Edit: As for the original socket.io issue, I did a quick test and adding remix-run/ seems to work, but examples/socket.io still shows the same issue.

PS C:\Users\Max\Desktop> npx create-remix@latest --template remix-run/examples/socket.io

 remix   v2.8.0 💿 Let's build a better website...

   dir   Where should we create your new project?
         ./my-remix-app

      â—¼  Template: Using remix-run/examples/socket.io...
      ✔  Template copied

   git   Initialize a new git repository?
         No

  deps   Install dependencies with npm?
         No
      â—¼  Skipping install step. Remember to install dependencies after setup with npm install.

  done   That's it!

         Enter your project directory using cd .\my-remix-app
         Check out README.md for development and deploy instructions.

         Join the community at https://rmx.as/discord
PS C:\Users\Max\Desktop> npx create-remix@latest --template examples/socket.io

 remix   v2.8.0 💿 Let's build a better website...

   dir   Where should we create your new project?
         ./my-remix-app

      â—¼  Template: Using examples/socket.io...

      â–²  Oh no! "examples/socket.io" is an invalid template. Run create-remix --help to see supported template formats.

maxrchung avatar Mar 04 '24 21:03 maxrchung

Fixed in #435

machour avatar May 17 '24 15:05 machour