首页 > 解决方案 > 无法使用 create-react-app 创建新的反应项目

问题描述

我正在尝试使用 create-react-app 创建一个新的反应项目,但每次它都因为这个错误而失败......

我正在使用npm版本6.3.0node版本10.8.0

我不知道该怎么办............

C:\Users\Demonblade\Desktop\test.

安装软件包。这可能需要几分钟。安装 react、react-dom 和 react-scripts...

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\Demonblade\AppData\Roaming\npm-cache\_logs\2018-08-09T15_27_48_357Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting test / from C:\Users\Demonblade\Desktop
Done.

标签: reactjscreate-react-app

解决方案


使用npx(它带有npm5.2+)。

反应文档

您需要在您的机器上安装 Node >= 6 和 npm >= 5.2。要创建项目,请运行:

npx create-react-app my-app
cd my-app
npm start

推荐阅读