Solved - You Need to Enable Javascript to Run This App
Tags: javascript, webdev, tutorial, react
Published: 2021-12-16 17:14:27

---
title: Solved - You Need to Enable Javascript to Run This App
published: true
date: 2021-12-12 08:24:10 UTC
tags: javascript, webdev, tutorial, react
canonical_url: https://www.upbeatcode.com/react/solved-you-need-to-enable-javascript-to-run-this-app/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tsbhzghsp4x9hcd04p9.png
---

One common error that React developers are facing is: You need to enable Javascript to run this app.

There are 3 possible solutions to solve **You need to enable Javascript to run this app** issue:

- Check if you have Javascript enabled in your browser.
- Set `homepage` and `proxy` inside `package.json` file.
- Serve React app locally.

# Why Does the Error Occur?

There are multiple reasons why you see _You need to enable Javascript to run this app_ error. In the next section, we're gonna take a closer look at each one of them. And provide a solution for each reason.

## How to Solve the Error

In this section, we're gonna discuss why you see _You need to enable Javascript to run this app_ error. And provide a solution for all the possible reasons.

## Solving Javascript Disabled by Browser

The most obvious solution is to check if you have Javascript enabled by the browser. After all, the error message is trying to say us that.

Here are the instructions to enable Javascript in all major browsers:

- [Chrome](https://support.google.com/adsense/answer/12654?hl=en)
- [Firefox](https://support.mozilla.org/en-US/questions/967344)
- [Safari](https://support.clio.com/hc/en-us/articles/360040902634-How-to-Enable-JavaScript-in-Your-Web-Browser)

This is the most simple solution, but usually, it's not the one that works. By default, we tend to have Javascript enabled because most of the websites are using it.

> If you don't have any problems browsing other websites, you'll most likely have Javascript enabled.

## Solving Wrong package.json Configuration

If you're running a backend server alongside your [React](https://reactjs.org/) app, and you see the following error. There is a high chance you don't have a proxy server configured properly.

> The following solution is trying to solve the issue when running the development server. If you're facing this issue only after running the production build, skip to the next section.

To fix this problem, try adding the following line inside your `package.json` file.

```json
"proxy": "http://localhost:5000"
```

> Make sure to change port 5000 to whatever port number the server is set up to listen to.

If the proxy setup doesn't solve your problem, you can try to set up [Express](https://expressjs.com/) server yourself.

Add the following line inside `package.json` file.

```json
"homepage": "."
```

And follow up with changes to `index.js` file.

```js
app.use(express.static(__dirname));

app.get("/*", function(req, res) {
  res.sendFile(path.join(__dirname, "index.html"));
});
```

## Solving Production Build Issues

If you're not having any problems when running your React app in the development server, but you see the _You need to enable Javascript to run this app_ error when you run production build. You probably need to set up a server to serve your React app correctly.

> We have an in-depth guide covering this topic. Follow the link on [How to Run React Build Locally](https://www.upbeatcode.com/react/how-to-run-react-js-build-locally/).

To serve a production build, you need to install a package called `serve`. And use it to serve a production build.

In your terminal, run the following command.

```shell
npm install -g serve
# Or if you're using Yarn
yarn global add serve
```

All that's left to do is tell `serve` package which folder you want to serve. Assuming you're inside your project directory. You'd run a command like this.

```shell
serve build
```

# Concluding Thoughts

**You need to enable Javascript to run this app** is a common error for React applications. And in times, it can also be a confusing one.

In this article, we covered the reasons you see _You need to enable Javascript to run this app_ error in your React app. And we also provided multiple solutions on how to handle this error.

Next time you're facing this error, you should know exactly how to troubleshoot it properly. And how to fix this error in your React project.