Skip to content

[Bug]: v7.22.0 almost broke every react project #15655

@realJustinLee

Description

@realJustinLee

EDIT by @nicolo-ribaudo

If you see a Cannot find module '@babel/plugin-proposal-private-property-in-object' error when using babel-preset-react-app or create-react-app:


💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

npx create-react-app my-app
cd my-app
npm start

Configuration file name

No response

Configuration

No response

Current and expected behavior

 ⚡ root@miami  ~/my-app   master  npm start

> [email protected] start
> react-scripts start

(node:55155) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:55155) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
Starting the development server...
Failed to compile.

Error: [BABEL] /root/my-app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object'
Require stack:
- /root/my-app/node_modules/babel-preset-react-app/create.js
- /root/my-app/node_modules/babel-preset-react-app/index.js
- /root/my-app/node_modules/@babel/core/lib/config/files/module-types.js
- /root/my-app/node_modules/@babel/core/lib/config/files/configuration.js
- /root/my-app/node_modules/@babel/core/lib/config/files/index.js
- /root/my-app/node_modules/@babel/core/lib/index.js
- /root/my-app/node_modules/@rollup/plugin-babel/dist/index.js
- /root/my-app/node_modules/workbox-build/build/lib/bundle.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/index.js
- /root/my-app/node_modules/react-scripts/config/webpack.config.js
- /root/my-app/node_modules/react-scripts/scripts/start.js (While processing: "/root/my-app/node_modules/babel-preset-react-app/index.js")
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)
    at cachedFunction.next (<anonymous>)
    at loadPresetDescriptor.next (<anonymous>)
    at recursePresetDescriptors.next (<anonymous>)
    at Generator.next (<anonymous>)
    at loadFullConfig.next (<anonymous>)
    at transform.next (<anonymous>)
    at new Promise (<anonymous>)
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /root/my-app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object'
Require stack:
- /root/my-app/node_modules/babel-preset-react-app/create.js
- /root/my-app/node_modules/babel-preset-react-app/index.js
- /root/my-app/node_modules/@babel/core/lib/config/files/module-types.js
- /root/my-app/node_modules/@babel/core/lib/config/files/configuration.js
- /root/my-app/node_modules/@babel/core/lib/config/files/index.js
- /root/my-app/node_modules/@babel/core/lib/index.js
- /root/my-app/node_modules/@rollup/plugin-babel/dist/index.js
- /root/my-app/node_modules/workbox-build/build/lib/bundle.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/index.js
- /root/my-app/node_modules/react-scripts/config/webpack.config.js
- /root/my-app/node_modules/react-scripts/scripts/start.js (While processing: "/root/my-app/node_modules/babel-preset-react-app/index.js")
    at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)
    at Module._load (node:internal/modules/cjs/loader:923:27)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at module.exports (/root/my-app/node_modules/babel-preset-react-app/create.js:168:9)
    at module.exports (/root/my-app/node_modules/babel-preset-react-app/index.js:19:10)
    at async (/root/my-app/node_modules/@babel/core/lib/gensync-utils/async.js:36:33)
    at async (/root/my-app/node_modules/gensync/index.js:186:15)
    at /root/my-app/node_modules/gensync/index.js:216:13
    at Generator.next (<anonymous>)
    at /root/my-app/node_modules/@babel/core/lib/config/full.js:181:21
    at Generator.next (<anonymous>)
    at Function.<anonymous> (/root/my-app/node_modules/@babel/core/lib/gensync-utils/async.js:21:3)
    at Generator.next (<anonymous>)
    at step (/root/my-app/node_modules/gensync/index.js:269:25)
    at evaluateAsync (/root/my-app/node_modules/gensync/index.js:291:5)
    at Function.errback (/root/my-app/node_modules/gensync/index.js:113:7)
    at errback (/root/my-app/node_modules/@babel/core/lib/gensync-utils/async.js:66:18)
    at async (/root/my-app/node_modules/gensync/index.js:188:17)
    at onFirstPause (/root/my-app/node_modules/gensync/index.js:216:13)
    at Generator.next (<anonymous>)
    at cachedFunction (/root/my-app/node_modules/@babel/core/lib/config/caching.js:52:46)
    at cachedFunction.next (<anonymous>)
    at loadPresetDescriptor (/root/my-app/node_modules/@babel/core/lib/config/full.js:294:43)
    at loadPresetDescriptor.next (<anonymous>)
    at recursePresetDescriptors (/root/my-app/node_modules/@babel/core/lib/config/full.js:77:31)
    at recursePresetDescriptors.next (<anonymous>)
    at /root/my-app/node_modules/@babel/core/lib/config/full.js:157:21
    at Generator.next (<anonymous>)
    at loadFullConfig (/root/my-app/node_modules/@babel/core/lib/config/full.js:113:5)
    at loadFullConfig.next (<anonymous>)
    at transform (/root/my-app/node_modules/@babel/core/lib/transform.js:20:45)
    at transform.next (<anonymous>)
    at step (/root/my-app/node_modules/gensync/index.js:269:25)
    at evaluateAsync (/root/my-app/node_modules/gensync/index.js:291:5)
    at errback (/root/my-app/node_modules/gensync/index.js:113:7)
    at stopHiding - secret - don't use this - v1 (/root/my-app/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:46:12)
    at transform (/root/my-app/node_modules/@babel/core/lib/transform.js:39:72)
    at node:internal/util:410:7
    at new Promise (<anonymous>)
    at transform (node:internal/util:396:12)
    at /root/my-app/node_modules/babel-loader/lib/transform.js:15:22
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/root/my-app/node_modules/babel-loader/lib/transform.js:3:103)
    at _next (/root/my-app/node_modules/babel-loader/lib/transform.js:4:194)
    at /root/my-app/node_modules/babel-loader/lib/transform.js:4:364
    at new Promise (<anonymous>)
    at /root/my-app/node_modules/babel-loader/lib/transform.js:4:97
    at /root/my-app/node_modules/babel-loader/lib/transform.js:48:17
    at /root/my-app/node_modules/babel-loader/lib/cache.js:130:26

ERROR in [eslint]
src/index.js
  Line 0:  Parsing error: [BABEL] /root/my-app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object'
Require stack:
- /root/my-app/node_modules/babel-preset-react-app/create.js
- /root/my-app/node_modules/babel-preset-react-app/index.js
- /root/my-app/node_modules/@babel/core/lib/config/files/module-types.js
- /root/my-app/node_modules/@babel/core/lib/config/files/configuration.js
- /root/my-app/node_modules/@babel/core/lib/config/files/index.js
- /root/my-app/node_modules/@babel/core/lib/index.js
- /root/my-app/node_modules/@rollup/plugin-babel/dist/index.js
- /root/my-app/node_modules/workbox-build/build/lib/bundle.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /root/my-app/node_modules/workbox-webpack-plugin/build/index.js
- /root/my-app/node_modules/react-scripts/config/webpack.config.js
- /root/my-app/node_modules/react-scripts/scripts/start.js (While processing: "/root/my-app/node_modules/babel-preset-react-app/prod.js")

webpack compiled with 2 errors

Environment

Ubuntu 23.04
Node 22.2.0
nom 9.6.7

Possible solution

No response

Additional context

Thanks to this genius update 2 hrs ago which almost drove everyone crazy.

Metadata

Metadata

Labels

i: regressioni: third partyThe report is a problem of third partyoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions