【问题标题】:why src and public folders missing in react creat app?为什么反应创建应用程序中缺少 src 和公用文件夹?
【发布时间】:2020-05-10 16:06:11
【问题描述】:

我正在尝试使用 npx create-react-app my-app 创建创建应用程序

我有 npm 6.13

和节点:12.14.1

我厌倦了关注create-react-app doesn't generate public and src folders thus cannot get started中的灵魂

但它不起作用?

有机会吗?

【问题讨论】:

  • 尝试使用npx create-react-app project_name创建项目

标签: node.js reactjs node-modules create-react-app npx


【解决方案1】:

您可能已经全局安装了 create-react-app。但 npx 始终使用最新版本的 create-react-app。请通过

检查 create-react-app 版本
create-react-app -v

并通过检查Changelog.md 确保它是最新的。如果没有尝试通过

卸载全局包
sudo npm uninstall -g create-react-app

确保您已全局卸载,然后尝试运行

npx create-react-app <project_name>

【讨论】:

  • 这与问题答案中描述的相同
  • 解决了防病毒问题
【解决方案2】:

最初尝试使用但未成功:npm rm -g create-react-appnpm install -g create-react-appnpx create-react-app &lt;your-app-name&gt;

以下命令有效:npx --ignore-existing create-react-app &lt;Your-AppName&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    • 2021-05-20
    • 2022-07-22
    • 1970-01-01
    • 2019-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多