模块解析失败:额外的babel_loader



我已经使用react传单有一段时间了,几周后我删除了node_modules中的文件并重新安装了它们,我根本没有接触到react传单的版本,但当我尝试运行项目时,它会给我一个错误。


/node_modules/@react传单/core/esm/path.js 10:41模块分析失败:意外的令牌(10:41(文件是用以下加载程序处理的:

  • /node_modules/react-scripts/node_modules/babel-loader/lib/index.js您可能需要一个额外的加载程序来处理这些加载程序的结果。|useEffect(函数updatePathOptions(({|if(props.pathOptions!==optionsRef.current({
const options = props.pathOptions ?? {};

|element.instance.setStyle(选项(;|optionsRef.current=选项;


为了运行它,必须降级react传单库以下是步骤:

  1. 移除反应传单:npm uninstall react-leaflet

  2. 将react脚本版本更新为3.3.0或更高版本:npm install --save react-scripts@latest

  3. 删除node_module目录(可选(

  4. 清理缓存:npm cache clean --force

  5. 安装工作版本:npm i react-leaflet@3.1.0 @react-leaflet/core@1.0.2

您现在可以运行客户端进行npm启动

相关内容

最新更新