Error installing create-react-app with npm

本秂侑毒 提交于 2020-05-17 09:51:32

问题


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

回答1:


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




回答2:


Did you try to execute the command as administrator?




回答3:


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


来源:https://stackoverflow.com/questions/53896092/error-installing-create-react-app-with-npm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!