React production build is returning 404 error - reactjs

npx create-react-app app-name
cd app-name
npm start
works fine but
npm run build
cd build
serve -s build
return 404
It's inbuilt react code. I have not changed anything.
running in the development server but not in the production server.
Is there anything am I doing wrong here?

Related

React server is not running through npm start

Good Evening I am doing a project in ReactJs through npm start project is compiling but has not started, loading for several minutes via localhost 3000 on google chrome. what should I do now?
Try to install Yarn using yarn install after that run following command
yarn start

create-react-app not working. Getting error "Module not found"

This is what I'm getting
I am not able to create a project using create-react-app, I get the error "Module not found".
Node version is 17.0.1 and Npm version is 8.1.1
I have reinstalled nodejs 3 times now and have tried different commands like
npm install create-react-app -g
npm cache clean --force
P.S - I have updated the nodejs to 17.0.1 as the picture version shows 16.13.0
You can try with npx create-react-app my-app.
Visit for more details create-react-app
To create a new app, you may choose one of the following methods:
npx
npx create-react-app my-app
npm
npm init react-app my-app
npm init <initializer> is available in npm 6+
Yarn
yarn create react-app my-app
yarn create is available in Yarn 0.25+
So after almost 3-4 hours of trying different things, it has worked.
I dont know which particular thing would have helped it to work but following are the things I tried -
Delete npm and npm cache folder.
Reinstall the nodejs (LTS version).
Create the app in another folder.
Used power shell instead of CMD.
npm fix
npm fix --force

how to run an already ready app in react js with npm

npx create-react-app my-app
cd my-app
npm start
This is how I created a react app. But if I get an already ready app in react how will I run it?
Inside the project directory run: npm install, this will install all of your project dependencies, and after that, you can start the app with the npm start command.
Open the Terminal,
Go to Project Directory
Use this command
npm install
It will install all the dependencies that are necessary to run this project.
Now run the development server
npm start
Development:
npm install
npm start
Production*:
./build/index.html
*if build folder doesn't exist then execute:
npm run build

How can i solve "No project found" error when installing react

I am new to react and i am taking my first course on openclassrooms on react.
The instructor is using the command
yarn global add create-react-app
to setup but when i run the commdand i get the error below
Usage Error: No project found in /E:/Web Dev/React/react-project
i have tried to use the command below that is provided in the react documentation but i stil get the same error
yarn create react-app my-app
How can i solve the problem i have looked up on the react documentation but still cannot find the solution.
I experienced the same issue and solved it as follows:
Uninstall yarn from npm using npm uninstall -g yarn
Install Yarn from Installation - Yarn Classic
Restart PowerShell / CMD
Before performing the above steps yarn --version printed 2.0.0-rc.27 on my machine. Now it prints 1.22.4.
Having Yarn 2.x globally installed is discouraged accourding to Installation - Yarn 2.x.

Can't run mlflow standalone react server

I need to run the frontend UI on a separate server as a stand-alone react app (not with all of the mlflow python server and packages). But when I run the production build, I get the following error:
You need to enable JavaScript to run this app.
Reproduce:
git clone https://github.com/mlflow/mlflow.git
cd mlflow/mlflow/server/js
In development mode, "npm start" it works just fine:
npm install
npm start
But when I've run it in production, I am getting the above error.
npm install
npm install -g serve
npm run build
serve -s build
I tried many things searching in forums, including this one:
I am getting error in console "You need to enable JavaScript to run this app." reactjs.
but I didn't manage to make it work.

Resources