简体   繁体   English

npx create-react-app 突然停止工作

[英]npx create-react-app has suddenly stopped working

I've been running 'npx create-react-app' for my projects for the last few months however today when I tried to run the command to create a new project I got this error:在过去的几个月里,我一直在为我的项目运行“npx create-react-app”,但是今天当我尝试运行命令来创建一个新项目时,我收到了这个错误:

Error Message错误信息

I've tried clearing my cache, running 'npx create-react-app@latest' with no luck so far.到目前为止,我已经尝试清除缓存,运行“npx create-react-app@latest”但没有成功。

Try clearing legacy-peer-deps尝试清除legacy-peer-deps

npx create-react-app myapp --legacy-peer-deps

I recently tried creating a new React project on React 18 with create-react-app and ran into this.我最近尝试使用 create-react-app 在 React 18 上创建一个新的 React 项目并遇到了这个问题。

The following worked for me:以下对我有用:

Open the project via vs code (or any other terminal) and run the npm install command again to install the dependencies:通过 vs code(或任何其他终端)打开项目并再次运行 npm 安装命令以安装依赖项:

npm install

If after running the above command, the same error still persists, try:如果运行上述命令后,仍然存在相同的错误,请尝试:

 npm install --legacy-peer-deps

It's a bug, we have to wait until the next update but you can try to install it and remove the node_module and after change the react-dom and react to a lower version like 17.0.2这是一个错误,我们必须等到下一次更新,但您可以尝试安装它并删除 node_module,然后更改 react-dom 并对 17.0.2 等较低版本做出反应

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

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