创建 React 应用程序:安装时未创建 src 和公共文件夹[重复]

问题描述 投票:0回答:1

我尝试创建一个 React 项目时使用

npx
或使用
yarn
总是冻结,

这是使用

CMD
时的
npx
部分:

D:\React_Redux_Course\React Projects>npx create-react-app my_app_test --use-npm
npx: installed 98 in 50.461s

Creating a new React app in D:\React_Redux_Course\React Projects\my_app_test.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


> [email protected] postinstall D:\React_Redux_Course\React Projects\my_app_test\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall D:\React_Redux_Course\React Projects\my_app_test\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall D:\React_Redux_Course\React Projects\my_app_test\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 1624 packages from 750 contributors and audited 1628 packages in 1030.934s

58 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

并在使用

yarn
命令以及以下命令时冻结:

D:\React_Redux_Course>yarn create react-app setup-antd-first
yarn create v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-react-app

Creating a new React app in D:\React_Redux_Course\setup-antd-first.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 14 new dependencies.
info Direct dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 212.18s.

我不知道问题到底出在哪里,可能仍然缺少需要安装的软件包或其他什么?

并且对于这两个文件夹,我都没有找到

src
文件夹,并且按照我的解释总是卡住或冻结......

请给我一些建议...

编辑:

这是冻结含义的屏幕截图:

Freeze

这是项目文件夹:

enter image description here

reactjs antd yarnpkg npx
1个回答
1
投票

首先您应该删除旧版本的

create-react-app
cli

现在执行以下操作即可创建您的应用程序。

  1. npm rm -g create-react-app
  2. npm install -g create-react-app
  3. npx create-react-app my-app

注意: 当使用正确的 create-react-app 版本时,您将看到一个额外的包

cra-template

安装软件包。这可能需要几分钟。
使用 cra-template 安装 React、React-dom 和 React-scripts...

虽然以前的版本显示类似这样的内容:

安装软件包。这可能需要几分钟。
正在安装react、react-dom和react-scripts...
© www.soinside.com 2019 - 2024. All rights reserved.