create-react-app: [BABEL] /usr/src/app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object' (0:undefined)
Describe the bug
When building a react app getting babel error. Syntax error: [BABEL] /usr/src/app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object' (0:undefined)
Did you try recovering your dependencies?
Not applicable
Which terms did you search for in User Guide?
N/A
Environment
N/A
Steps to reproduce
npm istall --legacy-peer-deps
npm run build
Expected behavior
Actual behavior
Reproducible demo
Not applicable
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 26
- Comments: 17
Commits related to this issue
- https://github.com/facebook/create-react-app/issues/13189 — committed to bundit/kord by deleted user a year ago
- Updating Babel Plugin I don't know what I'm doing here! I merely guessed this, with the help of https://github.com/facebook/create-react-app/issues/13189 after I was getting: > Error: Cannot find p... — committed to ThomasLandauer/symfony-docs by ThomasLandauer 8 months ago
- minor #19037 [Encore] Updating Babel Plugin (ThomasLandauer) This PR was merged into the 6.3 branch. Discussion ---------- [Encore] Updating Babel Plugin I don't know what I'm doing here! I merely... — committed to symfony/symfony-docs by xabbuh 8 months ago
- yarn add @babel/plugin-proposal-private-property-in-object yarn add @babel/plugin-proposal-private-methods — dev https://github.com/facebook/create-react-app/issues/13189#issuecomment-1669414279 — committed to duleorlovic/mdb_rails_webpack by duleorlovic 7 months ago
@vishalsinghsajwan @demitrious-tom A possible workaround given here is adding the following to the list of dependencies in the package.json file:
I ran into the same issue and this did the trick.
Just make sure that
@babel/plugin-proposal-private-property-in-object
is listed underdependencies
and notdevDependencies
.This is the reason you’re getting errors only when bundling for production and not development.
How do you mess up this bad is my question. Unfortunately adding “@babel/plugin-proposal-private-property-in-object”: “^7.21.0” to my dependencies and or installing doesnt work.
the solution is simple… use yarn to install the missing dependencies
yarn add @babel/plugin-proposal-private-methods — dev yarn add @babel/plugin-proposal-private-property-in-object
Possible workaround:
@babel/plugin-proposal-private-property-in-object
node_modules/
&package-lock.json
npm i
againsame issue, adding “@babel/plugin-proposal-private-property-in-object”: “^7.21.0” in package.json file work with
npm start
but notnpm run build
This worked for me and removed the warning
To make the build command work after adding “@babel/plugin-proposal-private-property-in-object”: “^7.21.0” to my package.json, I had to also add the package to the babel config as a plugin, and do the same for “@babel/plugin-proposal-private-methods”: “^7.18.6”:
I didn’t find any solution. Just one solution working for me is
NODE_ENV=development
, I have use this value in my .env file and on Azure server configuration i used above value and it’s working fine for me. if you useproduction
as environment it will not work.