1

I´m new to react, but I already created some apps, but today when I tried to create a new one, it just doesn´t work. I´m using Node version v15.6.0 and npm 7.4.0. My operating system is Windows 10.

My file tree I'm working on: C: Users\kryst\Documents\test-app\app\package.JSON

But when I run npx create-react-app app in C: Users\kryst\Documents\test-app directory, it throws these messages.

PS C:\Users\kryst\Documents\test-app> npx create-react-app app

You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:

npm ERR! code 1
npm ERR! path C:\Users\kryst\Documents\test-app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app app

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\kryst\AppData\Local\npm-cache\_logs\2021-02-07T09_22_38_962Z-debug.log

I´ve already tried npm cache clean --force , reinstalling the whole application and restarting the computer.

Do you have any idea how to fix this? I´d be grateful for anythig.

3 Answers 3

2

Starting from npm 7.0.0 the npx binary was rewritten and

the --ignore-existing option is removed. Locally installed bins are always present in the executed process PATH.

So the previously cached binary is always called first, and now we must explicitly state our intentions regarding the package version (just add @latest to package name):

npx create-react-app@latest app

Or if you want to remove old versions from the cache, just clear the _npx folder. You can find its location with npm get cache command.

Sign up to request clarification or add additional context in comments.

1 Comment

Clearing the contents of the _npx folder worked well for me.
1
npm install -g create-react-app --force

Comments

0

the solution is already in the error logs:

1-you have installed create-react-app globally on you machine, so remove any global installs with one of the following commands:

  npm uninstall -g create-react-app
  yarn global remove create-react-app

2-if you want to create an app just type:

npx create-react-app your_app_name

this will make npx to grab create-react-app from npm registry and run it locally without installing it.

1 Comment

I don't have installed create-react-app globally. But even when I run uninstall command and try it again it just doesn't work. Weirdly enough, when I tried to install it globally and then running npx create-react-app it worked. So I don't know what happened and why, but doing the exact opposite than I've been told solves the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.