I am getting error in console "You need to enable JavaScript to run this app." reactjs

Javascriptnode.jsReactjs

Javascript Problem Overview


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.

Javascript Solutions


Solution 1 - Javascript

I received this message when no proxy to the server was specified inside client package.json file.

"proxy": "http://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)

Solution 2 - Javascript

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"));
});

Solution 3 - Javascript

I received this error because an API call that I was making was being blocked because of an invalid API key.

Solution 4 - Javascript

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.

  1. Right click and select Inspect.
  2. Go to Application Tab.
  3. Clear everything from local storage, session storage and cookies.
  4. Refresh your website.

This resolved similar issue in my case and hope it will work for others.

Solution 5 - Javascript

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.

Solution 6 - Javascript

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.

Solution 7 - Javascript

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'));
})

Solution 8 - Javascript

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.

Solution 9 - Javascript

Also a react newbie, I hit this issue. Remembering to add ReactDOM.render(<MyClassName />, document.getElementById("root")); fixed it for me.

Solution 10 - Javascript

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

> http://localhost:5000

by default.

Solution 11 - Javascript

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

Solution 12 - Javascript

after adding proxy in react package.json restart the reacr server. This works for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJagdeesh KumarView Question on Stackoverflow
Solution 1 - JavascriptMaxWidthView Answer on Stackoverflow
Solution 2 - JavascriptDenys BushulyakView Answer on Stackoverflow
Solution 3 - JavascriptmostlyAsking7179View Answer on Stackoverflow
Solution 4 - JavascriptAnkit GargView Answer on Stackoverflow
Solution 5 - JavascriptPaulo CuellasView Answer on Stackoverflow
Solution 6 - JavascriptPhilipediaView Answer on Stackoverflow
Solution 7 - JavascriptJangya satapathyView Answer on Stackoverflow
Solution 8 - JavascriptLeoLozesView Answer on Stackoverflow
Solution 9 - Javascriptskedwards88View Answer on Stackoverflow
Solution 10 - JavascriptErkam D.View Answer on Stackoverflow
Solution 11 - Javascriptsarath chandraView Answer on Stackoverflow
Solution 12 - Javascriptsubhajit dasView Answer on Stackoverflow