gpt4 book ai didi

javascript - 如何修复 - 找不到模块 : Can't resolve '@babel/runtime/helpers/objectWithoutPropertiesLoose'

转载 作者:行者123 更新时间:2023-11-28 03:36:00 25 4
gpt4 key购买 nike

我正在开发一个 React 项目,在实现此包后出现以下错误 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

最佳答案

您可以安装@babel/runtime来解决问题:

使用 npm:

npm install --save @babel/runtime

使用 yarn :

yarn 添加@babel/runtime

关于javascript - 如何修复 - 找不到模块 : Can't resolve '@babel/runtime/helpers/objectWithoutPropertiesLoose' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57737270/

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