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

为何npx create-react-app执行异常?问题排查与解决记录

问题现象

执行npx create-react-app testapp无报错,仅输出以下内容:

$ npx create-react-app testapp
Please specify the project directory:
  create-react-app <project-directory>

For example:
  create-react-app my-react-app

Run create-react-app --help to see all options.

当前使用nvm管理Node版本,对应Node版本为v20.5.1,执行npx create-react-app --info获取到的环境信息如下:

$ npx create-react-app --info

Environment Info:

  current version of create-react-app: 5.0.1
  running from /home/devuser/.nvm/versions/node/v20.5.1/lib/node_modules/create-react-app

  System:
    OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
  Binaries:
    Node: 20.5.1 - ~/.nvm/versions/node/v20.5.1/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.8.0 - ~/.nvm/versions/node/v20.5.1/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: 5.0.1

更新记录

  • 更新1:切换nvm至Node LTS版本18.17.1后,CRA仍无法正常工作。
  • 更新2(2023-09-22):在系统中创建新用户,该用户可正常执行npx create-react-app。

结论

原shell环境存在异常,更简便的解决方式是重建shell环境。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 21:27:11