javascript - 如何修复 - 找不到模块:无法解析 '@babel/runtime/helpers/objectWithoutPropertiesLoose'
问题描述
我正在做一个反应项目,在实施这个包https://www.npmjs.com/package/react-bootstrap-typeahead后我收到以下错误,然后我收到以下错误。
Failed to compile
./node_modules/react-popper/lib/cjs/Popper.js
Module not found: Can't resolve '@babel/runtime/helpers/objectWithoutPropertiesLoose' in 'E:\reactjs\deveans-react-version\node_modules\react-popper\lib\cjs'
This error occurred during the build time and cannot be dismissed.
我找到了很多解决方案,我也尝试过https://github.com/jquense/yup/issues/216但仍然遇到同样的错误。
但是当我删除 Typeahead 组件时,它工作正常。
import React , { Component } from 'react'
import {Typeahead} from 'react-bootstrap-typeahead';
import 'react-bootstrap-typeahead/css/Typeahead.css';
class States extends Component {
state = {
multiple: false,
options: [
{id: 1, label: 'Pakistan'},
{id: 2, label: 'Indonesia'},
{id: 3, label: 'Turkey'},
{id: 4, label: 'Brazil'},
]
};
render () {
const {multiple} = this.state;
return (
<div>
<Typeahead
labelKey="label"
multiple={multiple}
options={this.state.options}
placeholder="Choose a state..."
/>
</div>
)
}
}
export default States
解决方案
嘿 !试试这个,它对我有用...... :)
使用 npm:
npm install --save @babel/runtime
使用纱线:
yarn add @babel/runtime
快乐编码!
推荐阅读
- java - java - 如何使用java转义不在字符串行尾的```\n```字符?
- jenkins - Jenkins Pipeline Robot 框架测试结果未显示在主页上
- ffmpeg - ffmpeg 分段过滤器不适用于 strftime 文件名模板
- elasticsearch - 根据 Elasticsearch 中的嵌套字段值按表达式排序
- python - 寻找最接近多维数据点的点?
- python - Django - /uploaddd 上的 TypeError 不可散列类型:'dict'
- java - Jenkins groovy 管道:指定 Java 选项
- vue.js - 为什么组件显示两次?
- mysql - SQL 中的条件分组
- python-3.x - 创建一个给定边界框的蒙版