kriasoft / react-starter-kit

The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
https://reactstarter.com
MIT License
22.69k stars 4.16k forks source link

Codespaces not working with "Use Template" (workaround: clone/fork/duplicate repo) #2030

Open raffertyuy opened 1 year ago

raffertyuy commented 1 year ago

The starter kit works great when running on local machine. The initial yarn install and yarn start works perfectly.

image

However. the following issues are encounted when running on GitHub codespaces.

  1. yarn install works.
  2. yarn start will run but throws this error
image

image

koistya commented 1 year ago

@raffertyuy thanks for the report! But I"m unable to reproduce this issue. Maybe you can try to drop Codeworkspaces VM and create a new one?

I tested with the smallest (2 CPU) Codespaces instance, as well as running the app inside of a DevContainer locally.

raffertyuy commented 1 year ago

Hi @koistya , I tried with 2 core and 4 core but didn't work. Now I tried deleting the entire repo and regenerated from scratch. Here are the errors I'm getting.

When starting codespaces, it will prompt to install a bunch of add-ons and then start with this (node version 16.19.0?) image

Since the above included yarn install, I basically tried yarn start, yarn install and yarn start again. I'm getting this zx error, also node version defaults to 19.6.0.

image

This is the forked public repo.

Thank you for the help!

koistya commented 1 year ago

Does yarn node ./scripts/start.js work? Or, yarn workspace app start? In that case, we can replace zx ./scripts/start.js with node ./scripts/start.js in the package.json file:

https://github.com/kriasoft/react-starter-kit/blob/906e56240619e12d1ec06f64a20ab18c2816c65d/package.json#L16

raffertyuy commented 1 year ago

Hi @koistya , sorry for the late reply.

yarn node ./scripts/start.js and node ./scripts/start.js runs image

but both result to image

raffertyuy commented 1 year ago

It appears that the issue is only for repos created through the Template.

The following worked

  1. Running codespaces straight from https://github.com/kriasoft/react-starter-kit will work.
  2. Cloning https://github.com/kriasoft/react-starter-kit and copy files into another repo. Start codespaces from there.

In both of these cases, zx isn't preinstalled, so the following sequence is what worked for me.

  1. yarn install
  2. npm install -g zx
  3. yarn start

After doing a file/folder compare between the template and the main repo, a lot of files are very different. Maybe the template is an older version?

image Left: Code from Template Right: Code from https://github.com/kriasoft/react-starter-kit

Let me know if there's an issue with using the code from the main repo without using the template.