Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix - Module not found: Can't resolve '@babel/runtime/helpers/objectWithoutPropertiesLoose'

I am working on a project of react and I am getting the following error after implement this package https://www.npmjs.com/package/react-bootstrap-typeahead then i get the following error.

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.

I found many solutions and I tried it too https://github.com/jquense/yup/issues/216 but still getting same error.

But when i remove Typeahead component then it works fine.

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
like image 927
amaan rajput Avatar asked Aug 31 '19 10:08

amaan rajput


People also ask

Can't resolve Babel runtime helpers inherits?

To solve the error "Module not found: Error: Can't resolve '@babel/runtime/helpers'", make sure to install the @babel/runtime package by opening your terminal in your project's root directory and running the command npm install @babel/runtime and restart your development server.

What is Babel runtime?

babel-runtime is a package that contains a polyfill and many other things that Babel can reference. You'd install it in your app with npm install babel-runtime. transform-runtime is a Babel plugin to process your source code and inject import foo from "babel-runtime" statements so that babel-runtime is actually used.


1 Answers

Hey 👋! Try this, it worked for me... :)

👉 Using npm:

npm install --save @babel/runtime

👉 Using yarn:

yarn add @babel/runtime

😎 Happy Coding!

like image 177
Kenn Avatar answered Sep 24 '22 12:09

Kenn