每次我创建一个 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!
我不知道从这里该怎么做,因为我现在构建的每个创建 react 应用程序都仍然存在错误!
这一定是一个常见问题,有人知道如何解决这个问题吗?!
最佳答案
在您的计算机用户文件夹中,有一个 node_modules
目录,并且 package-lock.json
使用 rm -rf User/node_modules
删除它们,并且rm -rf User/package-lock.json
之后删除项目运行中的 node_module
目录和 pack-lock.json
文件 再次 npm install
然后就可以了
关于javascript - create-react-app 总是抛出 babel 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55313054/