From 2a4f2b24baa3eccb53fcd8dcf9e353eba13139d1 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 1 Jul 2020 20:35:45 -0400 Subject: [PATCH 1/2] Explain how to uninstall create-react-app globally --- packages/react-scripts/scripts/init.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index 8e1bb3fca80..c1af63ac834 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -103,6 +103,11 @@ module.exports = function ( 'create-react-app' )} are no longer supported.` ); + console.error( + `You can fix this by running ${chalk.cyan( + 'npm uninstall -g create-react-app' + )} before using ${chalk.cyan('create-react-app')} again.` + ); return; } From 43a2961caea6db40c93eb234767d09fc18101d98 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 1 Jul 2020 20:38:26 -0400 Subject: [PATCH 2/2] Add uninstallation intructions for yarn --- README.md | 2 +- docusaurus/docs/adding-typescript.md | 4 ++-- docusaurus/docs/getting-started.md | 2 +- packages/react-scripts/scripts/init.js | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 08f1146db07..d2052385efa 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ cd my-app npm start ``` -If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that npx always uses the latest version. +If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` or `yarn global remove create-react-app` to ensure that npx always uses the latest version. _([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_ diff --git a/docusaurus/docs/adding-typescript.md b/docusaurus/docs/adding-typescript.md index 40c9c2242a8..78d1c356729 100644 --- a/docusaurus/docs/adding-typescript.md +++ b/docusaurus/docs/adding-typescript.md @@ -19,7 +19,7 @@ npx create-react-app my-app --template typescript yarn create react-app my-app --template typescript ``` -> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that `npx` always uses the latest version. +> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` or `yarn global remove create-react-app` to ensure that `npx` always uses the latest version. > > Global installs of `create-react-app` are no longer supported. @@ -47,7 +47,7 @@ You are not required to make a [`tsconfig.json` file](https://www.typescriptlang ## Troubleshooting -If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`. Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)). +If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`. Remove previously installed versions with `npm uninstall -g create-react-app` or `yarn global remove create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)). If you are currently using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript/), see [this blog post](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/) for instructions on how to migrate to Create React App. diff --git a/docusaurus/docs/getting-started.md b/docusaurus/docs/getting-started.md index 63406b2d8dc..b95bc100470 100644 --- a/docusaurus/docs/getting-started.md +++ b/docusaurus/docs/getting-started.md @@ -14,7 +14,7 @@ cd my-app npm start ``` -> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that `npx` always uses the latest version. +> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` or `yarn global remove create-react-app` to ensure that `npx` always uses the latest version. _([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_ diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index c1af63ac834..7b9958e8148 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -106,6 +106,8 @@ module.exports = function ( console.error( `You can fix this by running ${chalk.cyan( 'npm uninstall -g create-react-app' + )} or ${chalk.cyan( + 'yarn global remove create-react-app' )} before using ${chalk.cyan('create-react-app')} again.` ); return;