I am new to reactjs, I am working on a app. It was running fine, but when I've run npm run build command, I am getting error "You need to enable JavaScript to run this app.". I have made changes in server.js file even I've given "homepage": "./", but it did not solved my issue.
And I've checked by running laravel project, javascript is enabled in browser, also tried different browsers.
Someone please help me to overcome this error.
asked May 11, 2018 at 7:12
Jagdeesh KumarJagdeesh Kumar
1,3902 gold badges11 silver badges27 bronze badges
9
I received this message when no proxy to the server was specified inside client package.json file.
"proxy": "//localhost:5000"
[where 5000 should be changed to whatever port number the server was setup to listen to. In my case it also required server restart once added]
answered Dec 11, 2018 at 7:25
5
I had same problem. My workable solution:
package.json:
"homepage": "."
index.js:
app.use[express.static[__dirname]]; //here is important thing - no static directory, because all static :]
app.get["/*", function[req, res] {
res.sendFile[path.join[__dirname, "index.html"]];
}];
answered Apr 8, 2019 at 17:01
3
I received this error because an API call that I was making was being blocked because of an invalid API key.
answered Sep 23, 2020 at 17:13
Try to run in other browser and see if it is working.
If it works there then please try below things and refresh your website.
- Right click and select Inspect.
- Go to Application Tab.
- Clear everything from local storage, session storage and cookies.
- Refresh your website.
This resolved similar issue in my case and hope it will work for others.
answered Jan 17, 2021 at 11:03
0
Just make sure that this route must be appeared after at all other routes
app.get["/*", function [req, res] {
res.sendFile[path.resolve[__dirname, '../client/build', 'index.html']];
}]
answered Mar 30, 2021 at 3:08
1
I had the same problem. In my case, the class name wasn't following the patterns [must starts with uppercase]. As soon as I corrected it everything started to work well.
answered Nov 23, 2018 at 22:13
Go to your SignIn component or Register component, change the form tag to a div tag OR prevent the form default i.e [e.preventDefault]. Also make sure that Javascript is enabled in your browser.
answered Mar 23, 2020 at 22:05
PhilipediaPhilipedia
611 silver badge1 bronze badge
I had some cookies set in the same url [localhost:8080], probably from a previous development, and it was somehow messing with my React project. I only found out because [out of despair] I tried with another browser and it worked. I deleted the cookies and it worked perfectly.
answered Feb 28, 2019 at 14:54
Leo LozesLeo Lozes
1,3081 gold badge17 silver badges30 bronze badges
Also a react newbie, I hit this issue. Remembering to add ReactDOM.render[, document.getElementById["root"]];
fixed it for me.
answered Apr 24, 2020 at 23:14
1
In your react project folder install serve if you haven't installed it before;
npm install -g serve
Then serve your project with a static server;
serve -s build
The build is a folder generated by 'npm run build'.
That's it! Visit
//localhost:5000
by default.
answered Jun 23, 2021 at 15:48
If you are facing the error "You need to enable JavaScript to run this app." in reactjs then 9/10 times there is an issue with your API call. Please cross check API url string, parameters, action type, endpoints, action names, controller names and API call status. You'll be able to find the issue. verify endpoint url again and again. You'll definitely find a solutions. Also check ur VPN access if you're able to hit the end point.
Go to console --> network tab and see ur API status
answered Jan 27 at 10:45
after adding proxy in react package.json restart the reacr server. This works for me.
answered May 19 at 6:05
Had the same issue, when I was trying serve react static files in node js server. Was missing the following in index.js of server side code.
app.use[express.static[path.resolve[__dirname, '../client/build']]];
answered Aug 5 at 18:11
ShreehariShreehari
1271 silver badge8 bronze badges