Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 557
Jagdeesh Kumar Avatar asked May 11 '18 07:05

Jagdeesh Kumar


People also ask

Does React work if JavaScript is disabled?

React is a JavaScript framework for the front-end. Which means it executes in the browser. If you disable JavaScript in the browser, React doesn't work anymore. Just in the same way if you delete Photoshop from your computer, you can't open .


2 Answers

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)

like image 123
MaxWidth Avatar answered Sep 20 '22 09:09

MaxWidth


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")); }); 
like image 26
Denys Bushulyak Avatar answered Sep 20 '22 09:09

Denys Bushulyak