Open merryta opened 2 years ago
Hello, I just came across this problem, and I found that with this I could solve it
npx create-react-app@latest {project name}
Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)
npm uninstall -g create-react-app
we uninstall it and then I reinstall it npm install -g create-react-app
and voila, it worked for me
Thank you. I just fixed it by running npm install -g create-react-app@5.0.0
Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)
npm uninstall -g create-react-app
we uninstall it and then I reinstall it npm install -g create-react-app
and voila, it worked for me
I would advice against installing npm packages globally. Thus I would recommended that you instead do:
npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app
This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html
npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx
Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache
@MrEmanuel, the problem is that
npm uninstall -g create-react-app
does not solve the You are running create-react-app 4.0.3, which is behind the latest release (5.0.0). We no longer support global installation of Create React App
message that gives the title to this ticket.
So this is what happens when running npx create-react-app
as recommended, even after uninstalling globally.
PS C:\Repos> npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
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:
https://create-react-app.dev/docs/getting-started/
PS C:\Repos>
The solution as mentioned above is to just use npx create-react-app@latest
, but it's definitely a strange problem. I'm using a fresh installation of node and npm here. I'm running on Windows through PowerShell.
I have encountered this issue last week and my take is npm_config_yes=true create-react-app my-app@latest
npx clear-npx-cache worked for me.
I updated my answer to include the command do clear the cache as per the comment from @strongmove
@chuchude Thank you
Her is the solution => Thank you. I just fixed it by running npm install -g create-react-app@5.0.0
Thank you ..! Cant you please let me know that how to ren the project ?
--> I tried " react-scripts start " this but cant run the program. :(
Hello, I just came across this problem, and I found that with this I could solve it
npx create-react-app@latest {project name}
it works thanks 👍 ❤
Hello, I just came across this problem, and I found that with this I could solve it
npx create-react-app@latest {project name}
Thank you so much
just run
Uninstall create-react-app by running this code in your terminal
npm uninstall -g create-react-app
After uninstall done, install it again
npm install -g create-react-app
to test
npx create-react-app app-name
Thank you. I just fixed it by running
npm install -g create-react-app@5.0.0
Please avoid doing this. As mentioned in the docs (https://github.com/facebook/create-react-app#quick-overview), it is preferred to always run create-react-app
directly with npx
so that you always use the latest version instead of using a globally installed version. Of course, you need to uninstall any globally installed CRA version on your machine before trying it with npx
.
This answer here is better in general https://github.com/facebook/create-react-app/issues/11816#issuecomment-999470005
Of course, you need to uninstall any globally installed CRA version on your machine before trying it with
npx
.
@marko-hologram the whole point of this issue report is that uninstalling the old CRA globally does not work for some people and the error message is seen even after uninstalling
Of course, you need to uninstall any globally installed CRA version on your machine before trying it with
npx
.@marko-hologram the whole point of this issue report is that uninstalling the old CRA globally does not work for some people and the error message is seen even after uninstalling
Yes I understand that. There are potentially cases where people somehow have CRA installed globally in multiple places and they should uninstall it in multiple places potentially. I wanted to point out that installing the package globally doesn't really fix the issue and isn't the ideal solution going forward 😄
If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.
If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.
Yes, but those people are not reading this bug report because CRA works for them. The people for whom this bug report is useful are people who had installed CRA globally and now find that uninstalling it globally, as advised by the CLI, doesn't work. You're telling them that they should try to uninstall it (they already tried) and that they shouldn't have installed it globally in the first place (they can't change the past). How does it help?
If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.
Yes, but those people are not reading this big report. The people for whom this bug report is useful there are people who installed CRA globally and find that uninstalling it globally, as advised by the CLI, doesn't work. You're telling them that they should try to uninstall it (they already tried) and that they shouldn't have installed it globally in the first place (they can't change the past). How does it help?
I'm trying to suggest to them to actually take time and try to fix the underlying issue completely. Most of these GitHub issues I've seen here where people have trouble bootstrapping a CRA project are caused by a global install of CRA. So by taking a bit of time and fixing the issue they will make it easier for maintainers and for themselves in the long run. Re-installing it as global dependency is a temporary fix that will bite them in the ass later again and they will come here again and open another issue unnecessarily.
I'm trying to suggest to them to actually take time and try to fix the underlying issue completely.
Yet you don't mention how: you merely point them to a comment that tells them to uninstall the global CRA and clear the npx cache, which is what this user tried in the second post, without success. Again, how does this help?
Yet you don't mention how
Because I cannot pinpoint which of the possible fixes might apply to them. I'm at least trying to steer them in the right direction in order to find the solution instead of applying a temporary fix.
and clear the npx cache, which is what this user tried in the second post, without success. Again, how does this help?
That person didn't specifically mention that they cleared npx
cache, maybe they only cleared npm
cache?
I fixed this issue without running any scripts.
$ npx create-react-app my-app
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
I ended up doing this to clear cache under Ubuntu:
$ npm config get cache
/home/myuser/.npm
$ rm -r /home/myuser/.npm
$ sudo npm config get cache
/root/.npm
$ sudo rm -r /root/.npm
The result was:
$ npx create-react-app my-app
....
Success! Created my-app at /home/myuser/Documents/my-app
TLDR:
Clear both root and user npm cache
$ sudo rm -r ~/.npm /root/.npm
Clearing npx
cache solves the issue for me (no global install)
If npx clear-npx-cache
doesn't solve the issue, you can manually remove <CACHE_ROOT>/_npx
folder.
CACHE_ROOT
can be found with npm config get cache
For more details, <CACHE_ROOT>/_npx
folder contains subfolders with an ID format. One of these (linked to the user ? mine contained multiple) contains a package.json
, which should include
{
"dependencies": {
"create-react-app": "^4.0.3"
}
}
EDIT: Adam's answer is definitely the B plan if npx script doesn't work : manually nuke npx cache folder :rocket:
I fixed this issue by changing the version of the npm
I had the 16.11.1
version installed. Using nvm
I just changed the version to 14.18.1
> node -v
v16.11.1
> nvm use 14
Now using node v14.18.1 (npm v6.14.15)
> npx create-react-app my-app
I fixed this issue by changing the version of the
npm
I had the16.11.1
version installed. Usingnvm
I just changed the version to14.18.1
> node -v v16.11.1 > nvm use 14 Now using node v14.18.1 (npm v6.14.15) > npx create-react-app my-app
I'm guessing this works because different node versions that are managed by NVM have their own separate caches and install locations? If you go back to your v16.11.1 it potentially won't work again and one of the solutions in these comments could work for you. Just so that you aren't always stuck on Node v14.
None of the above listed solutions work for me, when trying to install v4.0.3 of create-react-app
.
I don't have CRA globally installed in neither npm nor yarn. Nuking npm cache folder did not help.
$ npx create-react-app@4.0.3 my-app
npx: installed 67 in 3.79s
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
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
Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me
I would advice against installing npm packages globally. Thus I would recommended that you instead do:
npm uninstall -g create-react-app npx clear-npx-cache npx create-react-app my-app
This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html
npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx
Edit: Thanks to @strongmove for suggesting to add
npx clear-npx-cache
Clearing the cache via npx clear-npx-cache worked for me as well
Now CRA projects start with npm and not yarn? 🤔
Now CRA projects start with npm and not yarn? 🤔
CRA now uses the package manager that you used to create the project instead of just defaulting to Yarn. https://create-react-app.dev/docs/getting-started#selecting-a-package-manager https://github.com/facebook/create-react-app/releases/tag/v5.0.0
Ok. So how do we use version 4.0.3 though? We cannot switch to Node 14 for... reasons.
If you want to run the previous version,
npx create-react-app --scripts-version 4.0.3
I tried every suggestion here to no avail. I'm using asdf
to manage node (but didn't always) so my local env is probably borked.
1) APP_NAME=my-app
2) Make the app directory on your host machine
mkdir $APP_NAME
cd $APP_NAME
/Users/kylesteger/apps/my-app
3) Build the docker image provided below
docker build -t react-app-builder --build-arg APP_NAME=$APP_NAME -f react-app-builder.dockerfile .
4) Run the image with the current directory mounted to the container dir
docker run -v $(pwd):/$APP_NAME react-app-builder:latest npx create-react-app $APP_NAME
5) Back on your host run npm start
node_modules
locally and reinstall FROM ubuntu
ARG APP_NAME
RUN apt update && \
apt install -y curl git && \
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \
bash nodesource_setup.sh && \
apt install nodejs
RUN mkdir ${APP_NAME}
I came across same problem this fixed it thank you YousefAlsbaihi
just run
Uninstall create-react-app by running this code in your terminal
npm uninstall -g create-react-app
After uninstall done, install it again npm install -g create-react-app
to test npx create-react-app app-name
I came across same problem this fixed it thank you YousefAlsbaihi
just run
Uninstall create-react-app by running this code in your terminal
npm uninstall -g create-react-app
After uninstall done, install it again
npm install -g create-react-app
to test
npx create-react-app app-name
Hey Steven - glad you're up and running - just be aware the docs no longer recommended having CRA globally installed. Did you try to uninstall the global then run an npx-clear-cache? Just curious.
I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache
in order for it to work I think for those of you having the same error after uninstalling globally, you should try uninstalling locally as well
I came across this problem and tried everything suggested here with no success. I am using NPM, but I just happened to remember using Yarn for a while earlier. Tried running the remove command for that as well and it solved the problem!
So, if you have tried everything else suggested here and have ever used both NPM and Yarn, don't overlook running both uninstall commands like I did at first.
I had the same issue but I tried this and it works: type this in your command
npx clear-npx-cache
then try to create a new project again.
npx clear-npx-cache
Clearing the cache was the correct solution. Using npx create-react-app@latest project
also worked for me.
Hello, I just came across this problem, and I found that with this I could solve it
npx create-react-app@latest {project name}
It worked. Thank you.
For those, like me, where none of the solutions mentioned in this forum worked here is another solution that fixed it right away: delete your entire node_modules folder. Then run the npx create-react-app my-app
I encountered the same issue. I have tried almost everything. uninstall, clear cache, and use npx create-react-app@5.0.0 but still not working. but the yarn does work. Can anyone help?
use the command npx create-react-app@5 .
if you are inside project folder or npx create-react-app@5 <PROJECT_NAME>
if you are outside the project folder. Use @5 only instead of @5.0.0 and it should work
npx clear-npx-cache
This solved my problem, and according to the documentation seems like the optimal way. Thank you very much
I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache
This is the only thing that worked for me.
the new version is working terrible with web3, why prevent the use of previous version?
Thank you. I just fixed it by running
I did this instead:
npx create-react-app@5.0.0 my-app-name
Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me
I would advice against installing npm packages globally. Thus I would recommended that you instead do:
npm uninstall -g create-react-app npx clear-npx-cache npx create-react-app my-app
This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html
npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx
Edit: Thanks to @strongmove for suggesting to add
npx clear-npx-cache
this work for me.
I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache
in order for it to work I think for those of you having the same error after uninstalling globally, you should try uninstalling locally as well
This worked for me.
Since they no longer support the global installation of Create React App. just uninstall it globally:
npm uninstall -g create-react-app
npx clear-npx-cache
Then install locally (root of your project):
npm install create-react-app
Then just create new app using the create-react-app
Hello, I just came across this problem, and I found that with this I could solve it
npx create-react-app@latest {project name}
This worked when I removed the { }
Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)
npm uninstall -g create-react-app
we uninstall it and then I reinstall it npm install -g create-react-app
and voila, it worked for me
I encountered the same issue. I have tried almost everything. uninstall, clear cache, and use npx create-react-app@5.0.0 but still not working. but the yarn does work. Can anyone help?