0

When I try to install create-react-app (or nodemon) globally or even within a project, I get the following error. However, I can install other packages perfectly fine both globally and locally. I think it has something to do with the fact that both create-react-app and nodemon are run from the terminal rather than used within a project's code.

I have already tried reinstalling nodejs and opening the terminal as administrator, but that did not work.

$ npm i -D nodemon
npm ERR! path C:\Users\Shivang\AppData\Roaming\npm-cache\_cacache\index-v5\78\49\9aac8fdb9b898c6d95e47da44f0425e95568d85f83d82f7bae06293b0a03
npm ERR! code UNKNOWN
npm ERR! errno -4094
npm ERR! syscall open
npm ERR! UNKNOWN: unknown error, open 'C:\Users\Shivang\AppData\Roaming\npm-cache\_cacache\index-v5\78\49\9aac8fdb9b898c6d95e47da44f0425e95568d85f83d82f7bae06293b0a03'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Shivang\AppData\Roaming\npm-cache\_logs\2018-12-22T13_29_35_317Z-debug.log

UPDATE: When I ran npm cache clean --force, I got the following error

$ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
npm ERR! path C:\Users\Shivang\AppData\Roaming\npm-cache\_cacache\index-v5\78
npm ERR! code UNKNOWN
npm ERR! errno -4094
npm ERR! syscall unlink
npm ERR! UNKNOWN: unknown error, unlink 'C:\Users\Shivang\AppData\Roaming\npm-cache\_cacache\index-v5\78'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Shivang\AppData\Roaming\npm-cache\_logs\2018-12-22T13_55_42_508Z-debug.log
7
  • For create react app try npx create-react-app appname, have you tried including sudo in front of the terminal commands? Commented Dec 22, 2018 at 14:52
  • I get the same error using npx. I am on Windows 10, so I can't sudo, but I have tried to run as admin which had no result. Commented Dec 22, 2018 at 14:57
  • Below the error, it also said: Install for create-react-app@latest failed with code 4294963202 Commented Dec 22, 2018 at 14:59
  • @ShivangPatel did you find any solution for this? Commented Nov 26, 2019 at 10:27
  • @Sikandar Sadly, no I did not. Commented Nov 27, 2019 at 11:07

6 Answers 6

2

Run npm cache clean --force and then try installing again

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

8 Comments

I got an error when running this command. Check my question for more details (I updated it).
@ShivangPatel delete the npm-cache found in this path: C:\Users\Shivang\AppData\Roaming\npm-cache and try again. This is definitely cache related issue
For some reason, I can't delete the folder. I tried right clicking and then clicking delete but that didn't work. I even tried dragging to the recycling bin, but that didn't work either.
@ShivangPatel then may be some virus infection or admin permission issues. Try again after restarting
I restarted and ran as admin, but it didn't make a difference. I am going to run a virus scanner right now.
|
0

Did you try to execute the command as administrator?

Comments

0

I was facing the same issue. Found a solution for the same.

  • Go to C:\Users\%UserName%\AppData\Roaming\npm-cache
  • Delete all items present there
  • Some files inside 1 or more folders you may not be able to delete, then just rename them to some random name.
  • Now retry npm install. It should work

Comments

0

Try running these commands.

npm cache clean --force

And then

sudo npm install -g create-react-app

This should work.

Comments

0

Use npx command instead of npm

Like this, First Mkdir appName mkdir appName Secondly Cd into the app cd appName

Thirdly run npx npx create-react-app ./

This how to run npx in react 18

Comments

0

Lol i just took the two previous answers and put them together. So the solution is:

npm cache clean --force (-g if first try doesnt work after npx). then just use npx instead of npm.

Comments

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.