search

Home  >  Q&A  >  body text

When the React application is running, the module '@babel/plugin-proposal-private-property-in-object' cannot be found.

I created a React application using npx create-react-app my_app but when I run the application using npm start I get the following error,

I tried to use npm install @babel/plugin-proposal-private-property-in-object to install the package "@babel/plugin-proposal-private-property-in-object", but still encountered to the same error. how to solve this problem?

P粉258788831P粉258788831448 days ago867

reply all(1)I'll reply

  • P粉078945182

    P粉0789451822023-11-04 10:20:22

    This is what worked for mebabel packagecombination:

    "devDependencies": {
        "@babel/core": "7.22.5",
        "@babel/eslint-parser": "7.22.5",
        "@babel/plugin-proposal-private-property-in-object": "7.21.11",
        "@babel/preset-env": "7.22.5",
    }
    

    Important Steps

    Add @babel/plugin-proposal-private-property-in-object to .babelrc plugin.

    Things like this:

    "plugins": [
        ["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
    ]
    

    reply
    0
  • Cancelreply