I was trying to start a new React Native project the other day, when I got this error message:

$ create-react-native-app my-fancy-project
-bash: create-react-app: command not found

What the frak does that mean?

Apparently this problem stems from NPM not being able to find the files needed to perform this operation. It turns out that I didn’t have a correct path set on my machine.

Step 1: Finding your way

In order to fix this you first need to find out where you keep all your NPM stuff. One way to do this is by using the ‘npm config get prefix’ command in your CLI, which will return the path to your NPM folder. It might look a little something like this:

$ npm config get prefix
C:\Users\[your name]\AppData\Roaming\npm //your file path

Copy the path, we’re going to need it later.

Step 2: Set your path

This tutorial is specific for Windows 10. This might work the same way in older Windows versions, but I haven’t tried it out. If you’re running MacOS - you’re on your own. If you’re running Linux, you’ve probably solved this problem yourself and I’ve no idea why you’re reading this blog post.

Open File Explorer, right click “This PC” and select “Properties”

The right click menu of This PC

Click “Advanced system settings”

Computer properties

Go to the “Advanced” tab, click the “Environment Variables” button

System properties window

In the “User variables” section, double click the “Path” row.

NOTICE! Do not, I repeat, DO NOT tinker with the “System variables” section. You could really mess things up if you don’t know what you’re doing.

Environment variables window

Double click an empty row in the newly opened window and paste the path you copied earlier. Make sure to not edit or delete any of your other paths, it could mess up other installations such as Java, Ruby, emulators, SDKs etc.

Edit environment variables window

Press OK. Back at the “System Properties” window, click apply.

Restart your CLI. Your machine should now be able to locate your NPM folder!