![](/img/trans.png)
[英]Error then trying create-react-app( npm ERR! cb() never called! then trying create-react-app)
[英]I've been trying to create a react app but I keep getting this error: "npm ERR! cb() never called!"
这就是问题
HP@DESKTOP-1HP83V8 MINGW64 ~/Desktop/Web-Development (master) $ npx create-react-app my-app
在 C:\Users\HP\Desktop\Web-Development\my-app 中创建一个新的 React 应用程序。
安装包。 这可能需要几分钟时间。
使用 cra-template 安装 react、react-dom 和 react-scripts...npm 错误! cb() 从未调用过!
npm 错误。 这是 npm 本身的错误:请在以下位置报告此错误:
npm 错误! https://npm.communitynpm ERR:此运行的完整日志可在以下位置找到:
npm 错误:C.\Users\HP\AppData\Roaming\npm-cache_logs\2020-11-20T11_50_51_060Z-debug.log中止安装。
npm 安装 --save --save-exact --loglevel 错误 react react-dom react-scripts >cra-template 失败。
我多次遇到这种情况。
首先,我建议您运行npm uninstall -g create-react-app
因为不再支持全局版本。
然后再次尝试npx create-react-app my-app
。
如果这不起作用,请尝试运行:
npm init
npm install create-react-app
npx create-react-app my-app
上述步骤已经为我解决了几次问题
断开并重新连接到您的互联网源 (WIFI)。
之后,运行npm cache verify
接下来您将要运行: rerun npx create
工作解决方案:感谢 idkwhatsgoingon 的回答。
create-react-app
在全球范围create-react-app
不起作用
先试试这个命令:
npm cache clean --force
并再次创建您的 React 应用程序。
我尝试了所有这些,它没有工作。 但是我重新启动了计算机并开始工作,因此在清除缓存等之后,可能值得重新启动机器( Windows 10 )
我在尝试安装 netlify-cli 时遇到了同样的错误。 为了解决这个问题,我做了两件事:
添加行
timeout=60000
到您的.npmrc
配置文件(如果它不存在,则在~/.npmrc
创建它)然后运行~/.npmrc
npx create-react-app project-name
应该会成功。 至少在我的情况下是这样。 (我之前有代码 ERR_SOCKET_TIMEOUT )
尝试安装纱线。 我这样做并立即解决了我的问题。
npm install --global yarn
我遇到了同样的错误。这是我为解决它所做的这些事情
首先通过npm uninstall -g create-react-app
然后npm cache clean -f
然后 npx npx create-react-app app-name
这对我有用
我运行npm cache verify
在这个命令之后,我运行sudo apt install rerun
然后我运行命令rerun npx create-react-app <app-name>
它像魔术一样工作
请尝试更改对我有用的 your.network。 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.