You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用create-react-app创建React应用失败,遇权限错误求助

解决npx create-react-app权限错误(EACCES: permission denied)

你的问题核心是npm缓存目录的权限归属问题,和系统完整性保护(csrutil)无关,不用折腾恢复模式,按以下步骤解决:

解决步骤

  • 修复.npm目录的所有权:
    执行命令将缓存目录的权限转回你的用户账号:
    sudo chown -R $USER:$USER /Users/lydiapurves-ware/.npm
    
  • 清理损坏的缓存(推荐):
    npm cache clean --force
    
  • 重新创建React应用:
    npx create-react-app myfirstreactapp
    

备选方案(如果上述步骤无效)

指定一个临时缓存目录绕开权限问题:

npx create-react-app myfirstreactapp --cache /tmp/npm-cache

内容的提问来源于stack exchange,提问作者ldpw

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 15:00:57