# Docker \> Building Images \> Exposing Ports: error message sh: react-scripts: command not found

**URL:** <https://forum.codewithmosh.com/t/docker-building-images-exposing-ports-error-message-sh-react-scripts-command-not-found/22593>\
**Category:** Docker\
**Created:** [September 18, 2023, 6:15pm UTC](https://forum.codewithmosh.com/t/docker-building-images-exposing-ports-error-message-sh-react-scripts-command-not-found/22593 "2023-09-18T18:15:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a1ryang](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@a1ryang](https://forum.codewithmosh.com/u/a1ryang)\
**Post date:** [September 18, 2023, 6:15pm UTC](https://forum.codewithmosh.com/t/docker-building-images-exposing-ports-error-message-sh-react-scripts-command-not-found/22593/1 "2023-09-18T18:15:41Z")

</div>

I’m using a MacBook Pro (2016) model running iTerm2. Here’s the issue in iTerm2:

> react-app@0.1.0 start  
> react-scripts start

**sh: react-scripts: command not found**  
aarongayah@A1ryanGs-MacBook-Pro section4-react-app %

I used the same code shown in the lesson. I had the same issue when using a Lenovo Laptop running Windows 11 which is why I’m using my MacBook Pro now. ChatGPT is advising the following, none of which are working:

**The error message `sh: react-scripts: command not found` indicates that the system cannot find the `react-scripts` package, which is essential for running the development server for your React app.**

### Step 1: Check package.json

Make sure you have a `package.json` file in your `section4-react-app` directory and that it contains `react-scripts` in the `"dependencies"` section.

Your `package.json` should look something like this:

jsonCopy code

```auto
{
  "name": "react-app",
  "version": "0.1.0",
  "dependencies": {
    "react": "^xx.x.x",
    "react-dom": "^xx.x.x",
    "react-scripts": "x.x.x"
  },
  "scripts": {
    "start": "react-scripts start"
  },
  ...
}

```

### Step 2: Reinstall Node Modules

Sometimes the `node_modules` folder can become corrupt or miss packages.

Delete your `node_modules` folder and `package-lock.json` file, and then reinstall your project dependencies.

bashCopy code

```auto
rm -rf node_modules package-lock.json
npm install

```

### Step 3: Run npm start Again

After you’ve reinstalled your `node_modules`, try running `npm start` again.

bashCopy code

```auto
npm start

```

### Step 4: Use npx

If it’s still not working, try using `npx` to run `react-scripts` directly.

bashCopy code

```auto
npx react-scripts start

```

### Step 5: Check Global Installation

Ensure that you haven’t installed `react-scripts` globally, which could cause conflicts. If you have, you might want to uninstall the global package:

bashCopy code

```auto
npm uninstall -g react-scripts

```

Then, navigate back to your project directory and reinstall the local package:

bashCopy code

```auto
cd path/to/section4-react-app
npm install react-scripts

```

The problem was not resolved. Please advise. I’ve spent three days trying to get past this bit to no avail.

---

<div class="post-metadata">

**Author:** ![a1ryang](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@a1ryang](https://forum.codewithmosh.com/u/a1ryang)\
**Post date:** [September 25, 2023, 1:53am UTC](https://forum.codewithmosh.com/t/docker-building-images-exposing-ports-error-message-sh-react-scripts-command-not-found/22593/2 "2023-09-25T01:53:54Z")

</div>

I figured out the problem. Adding the user/group/etc caused the code to break. Everything worked only after I removed those lines of code. It meant that I was the root user by default, but I could not find anything to resolve that issue.

ChatGPT was prompting to reinstall npm, etc, none of which worked on Windows or Mac.

---

<div class="post-metadata">

**Author:** ![lxray](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lxray](https://forum.codewithmosh.com/u/lxray)\
**Post date:** [May 24, 2024, 1:03pm UTC](https://forum.codewithmosh.com/t/docker-building-images-exposing-ports-error-message-sh-react-scripts-command-not-found/22593/3 "2024-05-24T13:03:55Z")

</div>

> [@a1ryang](#):
>
> user/group/etc caused

Just a little confused, having the same issue. You added that code to where?
