After using
npm run build
to build developed application for deployment it shows white screen when opening
build/index.html
while I'm setting homepage: "." in package.json.
Console Errors Screen shots
enter image description here
I have found a way to run the project whit a npm package called serve
serve -s build
this worked for me instead of opening the file from /build/index.html directly
Related
here's my github project
https://github.com/MangoYumm/Fashion
I have my main index.html public/index.html
app.js from src/app.js controls the frontend , which is made of Header,Body,Footer and all these have images in them.
"npm run start" works fine and everything is displayed when I run public/index.html.
now when I use "npm run build" , and run build/index.html , it doesn't show all the images. Only the F icon in Header is shown, and the stars in part1 of Body.
How to fix that?
I downloaded the repo and tried to run the project both with start and after building it.
Once you run: npm run build you then need to run the following:
serve -s build ( you may need to install it globally if it is not installed ).
React uses a variable called PUBLIC_URL to get the path to your resources it is the root path of your app. Opening just the index.html will not work as expected.
P.S.: no need to write npm run start you can also do this: npm start.
Hope it works!
I'm following the w3schools tutorial on react.
So the first thing I'm told to do is to create the create-react-app : npm install -g create-react-app
Then create a React application named myfirstreact : npx create-react-app myfirstreact
The app get created and every thing seems good at this point.
Now I'm asked to Run the React Application by doing the following: cd myfirstreact and npm start, and this is what the Terminal display
myfirstreact#0.1.0 start /root/myfirstreact
react-scripts start
Compiled successfully!
You can now view myfirstreact in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.43.128:3000
Note that the development build is not optimized.
To create a production build, use yarn build.
No new window gets opened in Firefox, nothing happens.
So I open the link http://localhost:3000 on Firefox and all I got is "EOF", I check the page source and the only thing there is is : EOF (which is the same thing I get If I access http://localhost:3000 on Firefox without starting react )
And what I want is to get the default react app.
Edit: I just downloaded Opera browser and when tried, The app works just fine. So the problem seems to be a Firefox problem.
Here you can see all the screenshots.
Terminal 1
Terminal 2
Terminal 3
Browser "EOF"
I closed Firefox, Started the app all over again npm start. And for some reason the app is working now
I'm trying to deploy a project so I did an npm run build and after it to check it I did serve -s build.
but when I'm checking the building one I get a blank page but in the regular project(not build), it is working fine.
I tried to see if its a problem of routing but didn't found.
Repo
I deployed it anyway so you can see.
Deploy of blank Page
In Package.json
Replace from
"homepage": "http://ethanolle.github.io/coca-cola"
to
"homepage": "."
Whenever I click 'run in iOS simulator' after running expo start in terminal, I'm getting stuck at a screen with "Downloading Javascript bundle 100.00%" in the app.
I'm creating a React native application and I tried all solutions including:
deleting Expo app
restarting simulator
erasing settings on simulator
rechecking code for bugs
Debug remote JS / stop remote debugging
See example of loading screen:
https://i.stack.imgur.com/RzEdZ.png
Delete your package-lock.json file, node_modules directory and then,
run npm cache clean -f.
Then run a new npm install as a regular user.
Finally, run an npm start again
try clearing the cache with expo start -c
I am a beginner and want to run a React project on my local machine. I cloned the project and cd into it and then run npm install. Then, I installed the dependencies using yarn install. Finally, I run npm start, but what shows up in my browser is the React logo and a message saying Edit src/App.js and save to reload.
What am I doing wrong?
The only wrong thing is that you ran yarn install after npm install, that two commands do the same thing.
That react logo and message is the app running, open App.js in an editor a try changing the text to see how it updates on the browser.