You need to enable javascript to run this app reactjs docker

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.

  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.

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

Not the answer you're looking for? Browse other questions tagged javascript node.js reactjs or ask your own question.

How do I fix JavaScript is not enabled?

On the web browser menu click on the "Edit" and select "Preferences". In the "Preferences" window select the "Security" tab. In the "Security" tab section "Web content" mark the "Enable JavaScript" checkbox. Click on the "Reload the current page" button of the web browser to refresh the page.

Can React work with JavaScript 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 .

How do I enable JavaScript?

Chrome Browser - Android - Turn JavaScript On / Off.
Apps icon. [Google] Chrome. . If unavailable, swipe up from the center of the display then tap. Chrome. ..
Tap the. Menu icon. [upper-right]..
Tap. Settings. ..
From the Advanced section, tap. Site settings. ..
Tap. JavaScript. ..
Tap the. JavaScript switch. to turn on or off ..

How add JavaScript in React?

Installation: Open a terminal inside your ReactJS project folder and write the following code to install react-script-tag Package. Import 'ScriptTag' component: Import the built-in 'ScriptTag' component from the react-script-tag library at the top of the file where we want to add the script tag.

Chủ Đề