簡體   English   中英

Npm 嘗試創建反應應用程序時出錯

[英]Npm Error when I try to create the react app

我正在嘗試開始創建反應應用程序,但我從 npm 收到此消息,請有人幫忙!

npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/fabiodiceglie/.npm/_cacache/content-v2/sha1/17/4b
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 501:20 "/Users/fabiodiceglie/.npm"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/fabiodiceglie/.npm/_logs/2022-01-22T10_33_07_875Z-debug-0.log

所以你有2個問題在這里發生。

問題 1 與 create-react-app 有關。 支持 create-react-app 的庫是 react-scripts。 作為 react-scripts 的一部分,使用了 lib tar。 react-scripts 正在使用不再獲得安全更新的過期版本的 tar。 沒關系,因為它應該只用於開發,您應該構建並將其用於生產。

第二個問題是您的 npm 的緩存文件夾歸 root 所有,因此非 root 用戶不能使用它。 你應該運行:
sudo chown -R 501:20 "/Users/fabiodiceglie/.npm"
修復它,然后你應該更新 npm :
npm install npm@latest -g
因此,如果您將來某個時間再次以 root 身份運行,您就不會遇到此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM