Create-react-app: How to run create-react-app using an .npmrc file to specify the NPM repo?

Created on 10 Mar 2017  路  2Comments  路  Source: facebook/create-react-app

I'm trying to run create-react-app from behind a corporate proxy. We use Artifactory to host our NPM packages. I'm able to install create-react-app using the command npm install -g create-react-app -reg <path\to\artifactory>. However when I try to run the create-react-app I get an error that none of the packages can be found in NPM, an error I commonly get when we haven't imported some NPM package to our Artifactory instance yet.

How can I run create-react-app and specify that it should download all packages from our local Artifactory?

question

Most helpful comment

You could set it globally for your user (at least until everything gets installed) by running npm config set registry <path/to/artifactory>, run create-react-app, then npm config delete registry if you want to revert the settings. After your create-react-app has finished installing everything, you can create a .npmrc file local to your project with the following contents:

registry=<path/to/artifactory>

Then whenever you install new packages, it will use your artifactory instance.

All 2 comments

You could set it globally for your user (at least until everything gets installed) by running npm config set registry <path/to/artifactory>, run create-react-app, then npm config delete registry if you want to revert the settings. After your create-react-app has finished installing everything, you can create a .npmrc file local to your project with the following contents:

registry=<path/to/artifactory>

Then whenever you install new packages, it will use your artifactory instance.

I believe this was answered!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aranir picture Aranir  路  3Comments

fson picture fson  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

alleroux picture alleroux  路  3Comments

ap13p picture ap13p  路  3Comments