Creating A React App -- Error attempting "npm install -g create-react-app"

When I enter “npm install -g create-react-app” into my terminal, it starts to install but then I get this error message:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! { [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’]
npm ERR! stack:
npm ERR! ‘Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’’,
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules’ }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

I’ve gone into that file to change access to read and write, but every time I try to run the code, its a different file blocking me.

It feels like a mistake to change permissions one by one every time, am I doing something wrong?

This link solved my problem.

I’m a little disappointed that of the dozens of posts for help almost none of them have any responses from Codecademy…

1 Like

posts do sometimes slip through the cracks

you do understand by now that -g means you want to install the package globally (for all users)? This does require “administrator” privileges indeed.

you can also install the package only for your current user, then you don’t need special permission

I wasted an hour digging around online when i should have just gone with whitepk86’s answer. Codecademy should update their instructions at to reflect this difficulty that seems to be very commonly encountered


I had the same problem. @whitepk86 's solution worked for me as well, thanks!

@stetim94 I do have admin privileges; is there a step you have to take before the Terminal will recognize this? Also, I don’t remember learning about -g yet in Codecademy. :wink: An update to the article, as flexidex suggests would be appreciated. (new users can only mention 2 people)

yes, you need to run the command as root (admin). the Sudo program is often used for this

1 Like

Got it! Thanks for your help!

Same solution for Windows? Because I had errors below while trying to create react app:
C:\Users\bamidele\Desktop>cd reactproject

C:\Users\bamidele\Desktop\reactproject>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See npm help json for definitive documentation on these fields
and exactly what they do.

Use npm install <pkg> afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (reactproject) ravenous
version: (1.0.0)
entry point: (index.js)
test command:
git repository:
author: Bambillo1
license: (ISC)
About to write to C:\Users\bamidele\Desktop\reactproject\package.json:

“name”: “ravenous”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
“author”: “Bambillo1”,
“license”: “ISC”

Is this OK? (yes)

C:\Users\bamidele\Desktop\reactproject>npm install webpack webpack-dev-server --save-dev
npm ERR! errno ENOTFOUND
npm ERR! network request to failed, reason: getaddrinfo ENOTFOUND
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bamidele\AppData\Roaming\npm-cache_logs\2019-08-05T16_09_58_186Z-debug.log


same solution for a very different problem? Looking at the error, you are experience a networking error, not a permission error

1 Like

I am having this problem when I type: create-react-app first-app
I followed the Creating a React App. Use create-react-app to bootstrap a React application on your own computer section

create-react-app first-app

Creating a new React app in C:\Users\Ricsson Ngo\Documents\Projects\React\first-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! Unexpected end of JSON input while parsing near '...MLWw==","shasum":"ef7'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ricsson Ngo\AppData\Roaming\npm-cache\_logs\2019-08-22T03_21_10_006Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting first-app/ from C:\Users\Ricsson Ngo\Documents\Projects\React

what is in the log?

Hi, I tried this without the ‘-g’ to avoid having to log in as “root”. It still threw up (fewer) errors. I then tried the next "create-react-app " command - but “-bash: create-react-app: command not found” was returned.

In the end I used the “npx create-react-app my-app” command instead which worked.

Agree perhaps these instructions need a little update.

1 Like

I also had the same issue.
I started by googling the “npm WARN checkPermissions” error and found this link:

it included some commands i wasn’t familiar with, so i just went with the solution @whitepk86 suggested, and it seemed to work, though there were some installation errors showing in the terminal.

What’s the difference between npm and npx?

i don’t find this a good article. You need a very good reason to change a system directory permissions to your users permission. This doesn’t really solve the problem, given another user (*nix system are multi-user) still has a problem

if you want to install a package globally, give yourself the right permissions for the installation (don’t change directory owner) or install the package for your user only (non-globally)

I’m actually on this right now and before installing anything I was googling what the command did and I ran into these two links
I’m trying to make sure I don’t do out of date things cause some of the lessons are outdated and needs updating.
How did you solve your issues?