首页 > 解决方案 > npm 错误!cb() 在创建第一个反应项目时从未在 windows10 上调用过

问题描述

使用命令“create-react-app myfirstapp”创建第一个反应应用程序时,出现以下错误:

D:\ReactProject>create-react-app myfirstapp

Creating a new React app in D:\ReactProject\myfirstapp.

Installing packages. This might take a couple of minutes.

Installing react, react-dom, and react-scripts with cra-template...

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:

npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\intex\AppData\Roaming\npm-cache\_logs\2021-02-19T07_57_36_091Z-debug.log

Aborting installation.

npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json

Deleting myfirstapp/ from D:\ReactProject

安装的 ReactJS 版本是:

D:\ReactProject>create-react-app --version
4.0.2

安装的节点版本是:

D:\ReactProject>node -v
v14.15.5

注意:这是我第一次在 Windows 机器上创建 ReactJS 应用程序,所以第一次在这台机器上安装了 NodeJS 并尝试创建反应应用程序并得到了上述错误。

请让我知道您对修复这些错误的建议。

另外,找到上面的附加屏幕截图。 在此处输入图像描述

标签: node.jsreactjs

解决方案


我刚刚在Windows 10上试过。我使用了 PowerShell 窗口。很简单,转到您的项目目录 -> 按住 shift 按钮并单击鼠标右键 -> 选择“在此处打开 PowerShell 窗口” -> 在该 cmd 中启动。这个对我有用。


推荐阅读