简体   繁体   English

npx create-react-app projectName 无法创建项目

[英]npx create-react-app projectName fails to create project

I am creating a react project using npx create-react-app experiment and I have been getting the below error, can anybody help with how to resolve it.我正在使用 npx create-react-app 实验创建一个反应项目,我收到以下错误,任何人都可以帮助解决它。 NB, I have uninstalled global installations of create-react-app注意,我已经卸载了 create-react-app 的全局安装

(base) sibulele@sibulele-X555LAB:~$ npx create-react-app experiment (base) sibulele@sibulele-X555LAB:~$ npx create-react-app 实验

Creating a new React app in /home/sibulele/experiment.在 /home/sibulele/experiment 中创建一个新的 React 应用程序。

Installing packages.安装软件包。 This might take a couple of minutes.这可能需要几分钟。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

yarn add v1.22.18 info No lockfile found. yarn add v1.22.18 info 找不到锁文件。 [1/4] Resolving packages... [1/4] 解决包...

warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported.警告 react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2:不再支持此 SVGO 版本。 Upgrade to v2.xx升级到 v2.xx

[2/4] Fetching packages... [3/4] Linking dependencies... warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5". [2/4] 获取包... [3/4] 链接依赖项... 警告“react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3”具有未满足的对等依赖项“@ babel/plugin-syntax-flow@^7.14.5"。

warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".警告“react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3”具有未满足的对等依赖关系“@babel/plugin-transform-react-jsx@^7.14.9”。

warning "react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2" has unmet peer dependency "typescript@>= 2.7".警告“react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2”具有未满足的对等依赖项“typescript@>= 2.7”。

warning "react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0" 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".警告“react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0”具有未满足的对等依赖性“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. [4/4] 构建新包...成功已保存锁定文件。 success Saved 745 new dependencies.成功保存了 745 个新依赖项。 info Direct dependencies ... info 直接依赖...

Done in 377.81s.在 377.81 秒内完成。

A template was not provided.没有提供模板。 This is likely because you're using an outdated version of create-react-app.这可能是因为您使用的是过时版本的 create-react-app。 Please note that global installs of create-react-app are no longer supported.请注意,不再支持 create-react-app 的全局安装。

You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.您可以通过运行 npm uninstall -g create-react-app 或 yarn global remove create-react-app 来解决此问题,然后再次使用 create-react-app。 (base) sibulele@sibulele-X555LAB:~$ npm audit found 0 vulnerabilities (base) sibulele@sibulele-X555LAB:~$ npm 审计发现 0 个漏洞

(base) sibulele@sibulele-X555LAB:~$ (基础)sibulele@sibulele-X555LAB:~$

If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.如果您之前通过npm install -g create-react-app create-react-app全局安装了 create-react-app,我们建议您使用npm uninstall -g create-react-app卸载该软件包,以确保 npx 始终使用最新版本。

Use either one of the below commands:使用以下任一命令:

  • npx create-react-app my-app

  • npm init react-app my-app

  • yarn create react-app my-app

if npm uninstall -g create-react-app stated above does not work.如果上述npm uninstall -g create-react-app不起作用。 Type where create-react-app to know where it is installed.键入where create-react-app以了解它的安装位置。 rm -rf /usr/local/bin/create-react-app to delete manually rm -rf /usr/local/bin/create-react-app手动删除

Thank you everyone.谢谢大家。 My question has been answered by @Kayzer161 on this post This SVGO version is no longer supported. @Kayzer161 在这篇文章中回答了我的问题。不再支持此 SVGO 版本。 Upgrade to v2.xx . 升级到 v2.xx

Here is the answer:-这是答案:-

create a react app by this command, npx create-react-app@latest my-app --use-npm通过这个命令创建一个反应应用程序,npx create-react-app@latest my-app --use-npm

I had a depreciated version of "tar" and I updated it by the following command:-我有一个折旧版本的“tar”,我通过以下命令对其进行了更新:-

sudo npm i tar须藤 npm 我焦油

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM