【问题标题】:Error then trying create-react-app( npm ERR! cb() never called! then trying create-react-app)然后尝试创建反应应用程序出错(npm ERR!cb()从未调用!然后尝试创建反应应用程序)
【发布时间】:2022-01-05 05:44:17
【问题描述】:

遇到一些麻烦,然后尝试创建反应应用程序

PS D:\Projects\Test> npx create-react-app my-app

Creating a new React app in D:\Projects\Test\my-app.

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\semen\AppData\Roaming\npm-cache\_logs\2022-01-05T05_29_35_153Z-debug.log

Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

我重新安装了几次 nodejs。将 nodejs 降级到 14.18.1 版本。尝试使用纱线。但是这种解决方案在我的情况下不起作用。我使用 Windows 10。 感谢您的帮助!

【问题讨论】:

  • 日志是怎么说的?
  • 这是最后几串日志。在此错误之前,一切都会成功。 ```` 4423 计时 npm 在 186464 毫秒内完成 4424 错误 cb() 从未调用! 4425 错误 这是 npm 本身的错误。请在以下位置报告此错误:4426 错误 npm.community> ```

标签: javascript node.js reactjs npm


【解决方案1】:

我在创建 React 应用后遇到了同样的错误,无法再安装任何包。

  1. 尝试使用npm cache verifynpm cache clean --force 清除缓存。
  2. 如果这不起作用,请尝试使用:npm clean-install 进行 npm 的全新安装。

【讨论】:

    【解决方案2】:

    这个错误以前发生在我身上,我已经按照这些步骤操作了,我希望它也适用于你。 您需要做的第一件事是卸载 create-react-app,然后再次 npm install。 您可以使用以下命令卸载 create-react-app: 如果你使用 NPM:

     npm uninstall -g create-react-app
    

    如果您使用 Yarn:

    yarn global remove create-react-app
    

    要创建新应用,您可以使用以下命令:

    npx create-react-app@latest your-project-name
    

    您必须注意到 create-react-app 不应该像 Create-React-app Docs 中记录的那样全局安装。

    另外请注意,可以肯定地说,始终使用 LTS 版本的节点(此时为 16.13.2)。

    它应该可以解决您启动新反应应用程序的问题。

    【讨论】:

      猜你喜欢
      • 2021-08-30
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 2021-03-03
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      相关资源
      最近更新 更多