-
First, check that you can run
node -v
andnpm -v
from a command line. Your 'node' version should be v6 or higher. -
If you can't run
node -v
, you'll need to install it (below). -
Once you can run
node
andnpm
, make sure you can load packages:npm install -g create-react-app
-
If errors occur, you'll need to configure npm to load packages from an npm "Registry" (below).
On Windows, install node from https://nodejs.org/
On Mac, I use nvm as it doesn't require installing node as root, and we can manage multiple node versions.
- Install nvm from https://github.com/creationix/nvm
- Run
nvm install node
(To list available versions: nvm ls-remote
)
On Linux, install node using your distribution's package manager.
If you're not behind a corporate firewall, skip this section.
Does your company have an internal registry (sometimes called a binary repository or Artifactory)? If so, try Option 1 below. Otherwise, use Option 2 below.
Use npm config
to set npm to use your company's internal Artifactory. For example:
-
npm config set registry https://artprod.dev.
mycompany.com/artifactory/api/npm/npm-repos
Don't forget to replace "mycompany" with your company's name, or find your company's Artifactory URL from a colleague.
If you can't access an Artifactory, try accessing the main npm registry, for example like this:
-
npm config set strict-ssl false
-
npm install -g --registry http://registry.npmjs.org/ --proxy http://proxy.
mycompany.com:81/ --https-proxy https://proxy.
mycompany.com:81/ --verbose --always-auth=false create-react-app
Don't forget to replace "mycompany" with your company's name.
This second command will install create-react-app
using the settings you provide. (You can also provide the same settings using npm config
if you prefer.)