Describe the bug
Immediately after running a fresh npx create-react-app . --template typescript I wanted to preview the app and start coding, so I run npm start. However, the localhost tab is empty, and when I inspect it the dev server just gives raw HTML for all endpoints, so the 'JavaScript code' my browser loaded was HTML! This is a fresh project from the TypeScript template.
Did you try recovering your dependencies?
I solely use NPM for my project, and I emptied everything but README.md before setting up the project.
Which terms did you search for in User Guide?
I have scanned the issue, but
Environment
I decided to ditch TypeScript and use the plain version (that works). Since I lost the originals, here's one for the plain template:
Environment Info:
current version of create-react-app: 5.0.1
running from /home/codespace/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: Linux 6.2 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (2) x64 AMD EPYC 7763 64-Core Processor
Binaries:
Node: 20.10.0 - ~/nvm/current/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.2.3 - ~/nvm/current/bin/npm
Browsers:
Chrome: Not Found
npmPackages:
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
react-scripts: 5.0.1 => 5.0.1
npmGlobalPackages:
create-react-app: Not Found
I am using Codespaces to develop my application, and I have made both projects on the same folder, repo, and instance with no shutdowns.
Steps to reproduce
- Make an empty Github repo
- Make and open a Codespace for that repo
- Create the project with
npx create-react-app . --template typescript on the repo folder
- Run
npm start
- A browser window should auto-open and ports should be forwarded (I use the desktop VS Code)
- Open DevTools, and a JavaScript error shows
Expected behavior
It should start normally like the javaScript version.
Actual behavior
The server returns the index HTML on all routes, thus the browser fails to parse the incorrect JavaScript and React doesn't load.
Reproducible demo
No demo is needed. This is a dev server issue, and I did not touch anything so create-react-app@5.0.1 should be enough to repro. I suspect the template plays a role since the plain one works.
Describe the bug
Immediately after running a fresh
npx create-react-app . --template typescriptI wanted to preview the app and start coding, so I runnpm start. However, the localhost tab is empty, and when I inspect it the dev server just gives raw HTML for all endpoints, so the 'JavaScript code' my browser loaded was HTML! This is a fresh project from the TypeScript template.Did you try recovering your dependencies?
I solely use NPM for my project, and I emptied everything but README.md before setting up the project.
Which terms did you search for in User Guide?
I have scanned the issue, but
Environment
I decided to ditch TypeScript and use the plain version (that works). Since I lost the originals, here's one for the plain template:
I am using Codespaces to develop my application, and I have made both projects on the same folder, repo, and instance with no shutdowns.
Steps to reproduce
npx create-react-app . --template typescripton the repo foldernpm startExpected behavior
It should start normally like the javaScript version.
Actual behavior
The server returns the index HTML on all routes, thus the browser fails to parse the incorrect JavaScript and React doesn't load.
Reproducible demo
No demo is needed. This is a dev server issue, and I did not touch anything so create-react-app@5.0.1 should be enough to repro. I suspect the template plays a role since the plain one works.