【问题标题】:The command create-react-app doesn't run, it creates an error命令 create-react-app 不运行,它会产生错误
【发布时间】:2021-02-26 02:41:34
【问题描述】:

$ npx create-react-app awesomeApp 错误:EPERM:不允许操作,mkdir 'C:\Users\' 找不到命令:create-react-app

【问题讨论】:

标签: reactjs


【解决方案1】:

如果您的用户名是“FirstName LastName”,这是 npm 中的一个错误

对此的快速解决方法是 -

如果您的用户名是 - Anand Chavan,您只需在 是ANANDC~1。即名字+First_Letter_of_your 姓+~1(全部大写)

npm config set cache "C:\Users\<UserNameWorkAround>\AppData\Roaming\npm-cache" --global

示例配置 - Anand Chavan 作为用户名。

npm config set cache "C:\Users\ANANDC~1\AppData\Roaming\npm-cache" --global

【讨论】:

    【解决方案2】:

    我在 Windows 中也遇到了同样的问题。我解决了它如下:

    这可能是由于您的用户名在您的用户名之间有空格。如果是这样,如果您使用的是 Windows,请在命令提示符下尝试此操作: npm config set cache "C:\Users\Your Name\AppData\Roaming\npm-cache" --global

    之后,再试一次:npx create-react-app awesome

    【讨论】:

      【解决方案3】:

      我在尝试全新安装 create-react-app 并运行旧版本时遇到 EPERM 错误。

      从 Windows 的病毒和威胁防护 (answer found here) 中排除 node_modules 文件夹,然后以管理员身份运行我的终端为我修复了它。

      【讨论】:

        猜你喜欢
        • 2020-09-22
        • 2022-06-14
        • 2021-06-07
        • 2017-02-09
        • 2016-12-09
        • 1970-01-01
        • 2021-02-26
        • 2021-04-28
        • 1970-01-01
        相关资源
        最近更新 更多