Q:

Install ReactJS on Ubuntu 18.04 -- npm permission denied

I am new to Linux and I am trying to get set-up with nodejs, but I have not been able to figure out why I can't install react. I am following directions that I have seen on the web, but I am wondering why I seem to not have the privileges necessary to install react. It's a personal environment, so I wasn't expecting any issue. Below is what I have run and the final error that the last line gave me. 
sudo apt update && sudo apt upgrade
sudo apt install nodejs
sudo npm install npm

node -v
v8.10.0

npm -v
3.5.2

sudo npm install npm@latest -g
npm -v
6.10.0

npm install -g create-react-app

Everything above runs just fine until the last command. Then I get the following error, regardless of working directory.
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: '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).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/me/.npm/_logs/2019-07-06T19_33_32_971Z-debug.log

A:

Using npx (with npm 5.2+)
If you're using npm 5.2+, you may create a ReactJS app like below:
npx create-react-app my-app

Now your app is in a folder my-app, you can cd into the folder and run npm start.
Using older versions of npm with npm install
You may also install it with a global install with npm, infact for older npm versions (< 5.2) the official documentation for create-react-app links to instructions by Dan Abramov (@co-author of create-react-app):
npm install -g create-react-app

However you may need sudo for a global -g install or work around it

Everything above runs just fine until the last command. Then I get the following error, regardless of working directory.

That's because your last command is a global install (-g). 
Unless there is a reason against, you may install it with sudo:
sudo npm install -g create-react-app

To install without sudo, please refer to this question: npm throws error without sudo

