reactjs - 如何解决 React 组件的 YARN 编译错误?
问题描述
我开始在 React Web 应用程序的世界中构建自己的方式,因为我正在关注此处提供的 Carbon Design System 教程:https ://www.carbondesignsystem.com/developing/react-tutorial/step-1
因为当我开始根据页面的步骤添加路由时,我发现自己陷入了以下无法编译的错误:
Failed to compile.
./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js
TypeError: [BABEL] /home/hvg1928/carbon-tutorial/node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js: api.assumption is not a function (While processing: "/home/hvg1928/carbon-tutorial/node_modules/babel-preset-react-app/dependencies.js$0$18")
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
据我了解,正在调用 React Refresh 插件中的 api.assumption ,我没有在 package.json 文件的依赖项中看到它:
"dependencies": {
"@carbon/icons-react": "10.22.0",
"caniuse-lite": "^1.0.30001258",
"carbon-components": "10.25.0",
"carbon-components-react": "7.25.0",
"carbon-icons": "7.0.7",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.5",
"react": "16.10.0",
"react-dom": "16.10.0",
"react-router-dom": "5.0.0",
"react-scripts": "4.0.1"
},
基于此,我应该从哪里开始寻找解决此编译错误的问题?是否有一系列步骤可用于解决此类编译错误?
解决方案
推荐阅读
- c# - Xamarin Android,如何将 POST 数据发送到 MySQL 数据库中的 PHP 页面?
- ios-darkmode - 在 viewDidLoad 中使用动态颜色如何自动切换深色模式的颜色?
- javascript - 通过 javascript 使用本地存储
- react-native - 当 react-native 中的数据发生变化时重新渲染平面列表
- reactjs - 远处的诡异动作:Electron & React useEffect - 无法取消订阅 ipcRenderer 事件
- mysql - 在mysql中使用CONCAT里面的CONCAT
- java - 查询所有文档中的字段并确定该字段在哪个文档中找到?
- go - 需要与 Makefile 一起使用多个 Go 版本
- swift - 在 ForEach 循环中增加变量(SwiftUI)
- javascript - 使用 Nuxt.js 选择网站框架的初学者