Create-react-app 不允许我创建 React 应用程序,终端中打印出很多错误代码

问题描述 投票:0回答:1

我是 React 新手,刚刚完成一堂课,其中详细介绍了如何创建新应用程序,但它并没有按照课程所安排的方式工作。我在终端中打印出一大堆错误。我在下面列出了终端中打印的内容:

Lydias-Air:~ lydiapurves-ware$ npx create-react-app myfirstreactapp
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

npm ERR! code EEXIST

npm ERR! syscall mkdir

npm ERR! path /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

npm ERR! errno -13

npm ERR! EACCES: permission denied, mkdir '/Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c'

npm ERR! File exists: /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

npm ERR! Remove the existing file and try again, or run npm

npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in: /Users/lydiapurves-ware/.npm/_logs/2024-03-20T11_38_25_030Z-debug-0.log

我查找了一些可能的解决方案,发现一堆帖子说恢复模式下的 csrutil 应该修复它,但它没有。我预计它会修复我自己的计算机上没有的任何权限,但是,是的,我仍然没有某些权限。 任何帮助将不胜感激!

javascript reactjs terminal command-line
1个回答
0
投票

您的权限似乎存在问题。

npm ERR! EACCES: permission denied, mkdir '/Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c'    

您是否尝试过使用 sudo 运行该命令?

此外,我相信该块要求您从缓存中删除文件。

npm ERR! File exists: /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

npm ERR! Remove the existing file and try again, or run npm

npm ERR! with --force to overwrite files recklessly.

您可以尝试使用

npm clean cache --force
清除缓存,或者运行
npx create-react-app my_app --force
,npm 将尝试强制覆盖该文件。

© www.soinside.com 2019 - 2024. All rights reserved.