gpt4 book ai didi

javascript - create-react-app 总是抛出 babel 错误

转载 作者:行者123 更新时间:2023-11-30 06:17:27 25 4
gpt4 key购买 nike

每次我创建一个 create-react-app 项目时它都会抛出这个错误:

The react-scripts package provided by Create React App requires a dependency:

"babel-loader": "8.0.4"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:

/Users/dalegrant/Desktop/hyberchat-dashboard/client/node_modules/babel-loader (version: 8.0.5)

我已经尝试降级到 8.0.4,

我试过安装 8.0.5

我什至确保我对 babel 的所有依赖都依赖于 8.0.5!

我不知道从这里开始做什么,因为我现在构建的每个 create react 应用程序都存在错误!

这一定是一个常见问题,有人知道如何解决这个问题吗?!

最佳答案

在你的机器用户文件夹中有一个 node_modules 目录和 package-lock.json 删除它们使用 rm -rf User/node_modulesrm -rf User/package-lock.json 之后删除 node_module 目录和项目中的 pack-lock.json 文件运行 再次 npm install 然后就可以了

关于javascript - create-react-app 总是抛出 babel 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55313054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com