Describe the bug
Storybook builds fine in Node 12 (the latest LTS version) but fails in Node 13 (the latest Current version) with error cannot find module @babel/compat-data/corejs3-shipped-proposals
.
To Reproduce
Build a React Storybook project with Node 13.
Logs
Here are the full build logs:
2020-04-20T13:59:34.5474279Z info @storybook/react v5.3.17
2020-04-20T13:59:34.5475745Z info
2020-04-20T13:59:34.5489934Z info clean outputDir..
2020-04-20T13:59:34.5695422Z info => Copying static files from: public
2020-04-20T13:59:34.5696240Z info => Copying prebuild dll's..
2020-04-20T13:59:34.5733932Z info => Building manager..
2020-04-20T13:59:34.5736917Z info => Loading manager config..
2020-04-20T13:59:34.5754999Z info => Loading presets
2020-04-20T13:59:34.9917905Z info => Loading custom manager config.
2020-04-20T13:59:34.9992102Z info => Compiling manager..
2020-04-20T14:00:01.6660748Z info => manager built (27 s)
2020-04-20T14:00:01.8006707Z info => Building preview..
2020-04-20T14:00:01.8010909Z info => Loading preview config..
2020-04-20T14:00:01.8030982Z info => Loading presets
2020-04-20T14:00:01.9197990Z info => Loading config/preview file in "./.storybook".
2020-04-20T14:00:01.9198265Z info => Adding stories defined in ".storybook/main.js".
2020-04-20T14:00:01.9482105Z info => Loading Webpack configuration from `node_modules/react-scripts`
2020-04-20T14:00:01.9482484Z info => Removing existing JavaScript and TypeScript rules.
2020-04-20T14:00:02.5784558Z info => Modifying Create React App rules.
2020-04-20T14:00:02.5826857Z info => Loading custom Webpack config (full-control mode).
2020-04-20T14:00:02.5835617Z info => Compiling preview..
2020-04-20T14:00:02.6621739Z <s> [webpack.Progress] 0% compiling
<...>
2020-04-20T14:00:35.4316201Z <s> [webpack.Progress] 100%
2020-04-20T14:00:35.4320218Z
2020-04-20T14:00:35.4355253Z ERR! => Failed to build the preview
2020-04-20T14:00:35.5169453Z ERR! ./.storybook/generated-entry.js
2020-04-20T14:00:35.5169898Z ERR! Module build failed (from ./node_modules/babel-loader/lib/index.js):
2020-04-20T14:00:35.5170244Z ERR! Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
2020-04-20T14:00:35.5170385Z ERR! Require stack:
2020-04-20T14:00:35.5171142Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
2020-04-20T14:00:35.5171506Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js
2020-04-20T14:00:35.5171872Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/plugins.js
2020-04-20T14:00:35.5172359Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/index.js
2020-04-20T14:00:35.5179674Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/index.js
2020-04-20T14:00:35.5180075Z ERR! - /__w/<PROJECT_ROOT>/node_modules/babel-plugin-apply-mdx-type-prop/index.js
2020-04-20T14:00:35.5180430Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js
2020-04-20T14:00:35.5180808Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js
2020-04-20T14:00:35.5181604Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/mdx-compiler-plugin.js
2020-04-20T14:00:35.5182865Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/frameworks/common/preset.js
2020-04-20T14:00:35.5183263Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/preset.js
2020-04-20T14:00:35.5183626Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/preset.js
2020-04-20T14:00:35.5183987Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/presets.js
2020-04-20T14:00:35.5184349Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/config.js
2020-04-20T14:00:35.5184712Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/build-static.js
2020-04-20T14:00:35.5185046Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/server.js
2020-04-20T14:00:35.5185402Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/dist/server/build.js
2020-04-20T14:00:35.5185750Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/bin/build.js
2020-04-20T14:00:35.5185917Z ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
2020-04-20T14:00:35.5186073Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:835:27)
2020-04-20T14:00:35.5186219Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5186360Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5186963Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js:10:55)
2020-04-20T14:00:35.5187131Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5187278Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5187422Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5187557Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5187703Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5187840Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5188221Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js:29:44)
2020-04-20T14:00:35.5188375Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5188522Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5188668Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5189084Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5189755Z ERR! @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js ./.storybook/preview.tsx ./node_modules/@storybook/addon-knobs/dist/preset/addDecorator.js ./.storybook/generated-entry.js main[6]
2020-04-20T14:00:35.5190062Z ERR! ./.storybook/preview.tsx
2020-04-20T14:00:35.5190378Z ERR! Module build failed (from ./node_modules/babel-loader/lib/index.js):
2020-04-20T14:00:35.5190711Z ERR! Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
2020-04-20T14:00:35.5190848Z ERR! Require stack:
2020-04-20T14:00:35.5191207Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
2020-04-20T14:00:35.5191568Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js
2020-04-20T14:00:35.5191928Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/plugins.js
2020-04-20T14:00:35.5192267Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/index.js
2020-04-20T14:00:35.5192615Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/index.js
2020-04-20T14:00:35.5192978Z ERR! - /__w/<PROJECT_ROOT>/node_modules/babel-plugin-apply-mdx-type-prop/index.js
2020-04-20T14:00:35.5193328Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js
2020-04-20T14:00:35.5193700Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js
2020-04-20T14:00:35.5194069Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/mdx-compiler-plugin.js
2020-04-20T14:00:35.5194449Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/frameworks/common/preset.js
2020-04-20T14:00:35.5194806Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/preset.js
2020-04-20T14:00:35.5195154Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/preset.js
2020-04-20T14:00:35.5195512Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/presets.js
2020-04-20T14:00:35.5195870Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/config.js
2020-04-20T14:00:35.5196232Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/build-static.js
2020-04-20T14:00:35.5196577Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/server.js
2020-04-20T14:00:35.5196938Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/dist/server/build.js
2020-04-20T14:00:35.5197283Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/bin/build.js
2020-04-20T14:00:35.5197438Z ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
2020-04-20T14:00:35.5197590Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:835:27)
2020-04-20T14:00:35.5197734Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5197870Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5198277Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js:10:55)
2020-04-20T14:00:35.5198444Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5198592Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5198825Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5198964Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5199104Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5199240Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5199681Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js:29:44)
2020-04-20T14:00:35.5204630Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5204809Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5204955Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5205091Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5205918Z ERR! @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js ./.storybook/preview.tsx ./node_modules/@storybook/addon-knobs/dist/preset/addDecorator.js ./.storybook/generated-entry.js main[4]
2020-04-20T14:00:35.5206259Z ERR! ./node_modules/acorn-jsx/index.js
2020-04-20T14:00:35.5206569Z ERR! Module build failed (from ./node_modules/babel-loader/lib/index.js):
2020-04-20T14:00:35.5206896Z ERR! Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
2020-04-20T14:00:35.5207037Z ERR! Require stack:
2020-04-20T14:00:35.5207397Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
2020-04-20T14:00:35.5207752Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js
2020-04-20T14:00:35.5208118Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/plugins.js
2020-04-20T14:00:35.5208469Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/config/files/index.js
2020-04-20T14:00:35.5208815Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@babel/core/lib/index.js
2020-04-20T14:00:35.5209184Z ERR! - /__w/<PROJECT_ROOT>/node_modules/babel-plugin-apply-mdx-type-prop/index.js
2020-04-20T14:00:35.5209518Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js
2020-04-20T14:00:35.5209889Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js
2020-04-20T14:00:35.5210258Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/mdx-compiler-plugin.js
2020-04-20T14:00:35.5210632Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/frameworks/common/preset.js
2020-04-20T14:00:35.5210996Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/dist/preset.js
2020-04-20T14:00:35.5212105Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/addon-docs/preset.js
2020-04-20T14:00:35.5213149Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/presets.js
2020-04-20T14:00:35.5213933Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/config.js
2020-04-20T14:00:35.5214316Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/dist/server/build-static.js
2020-04-20T14:00:35.5214658Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/core/server.js
2020-04-20T14:00:35.5215012Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/dist/server/build.js
2020-04-20T14:00:35.5215599Z ERR! - /__w/<PROJECT_ROOT>/node_modules/@storybook/react/bin/build.js
2020-04-20T14:00:35.5215757Z ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
2020-04-20T14:00:35.5215905Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:835:27)
2020-04-20T14:00:35.5216122Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5216263Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5216678Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js:10:55)
2020-04-20T14:00:35.5216848Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5216998Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5217151Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5217294Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5217436Z ERR! at Module.require (internal/modules/cjs/loader.js:1012:19)
2020-04-20T14:00:35.5217576Z ERR! at require (internal/modules/cjs/helpers.js:72:18)
2020-04-20T14:00:35.5217953Z ERR! at Object.<anonymous> (/__w/<PROJECT_ROOT>/node_modules/@babel/preset-env/lib/index.js:29:44)
2020-04-20T14:00:35.5218112Z ERR! at Module._compile (internal/modules/cjs/loader.js:1123:30)
2020-04-20T14:00:35.5218257Z ERR! at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2020-04-20T14:00:35.5218405Z ERR! at Module.load (internal/modules/cjs/loader.js:972:32)
2020-04-20T14:00:35.5218529Z ERR! at Function.Module._load (internal/modules/cjs/loader.js:872:14)
2020-04-20T14:00:35.5218884Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/lib/inspection/acornParser.js 18:39-59
2020-04-20T14:00:35.5219239Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/lib/inspection/inspectValue.js
2020-04-20T14:00:35.5219580Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/lib/inspection/index.js
2020-04-20T14:00:35.5219920Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/propTypes/createType.js
2020-04-20T14:00:35.5220256Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/propTypes/handleProp.js
2020-04-20T14:00:35.5220592Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/extractProps.js
2020-04-20T14:00:35.5220910Z ERR! @ ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js
2020-04-20T14:00:35.5221633Z ERR! @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js ./.storybook/preview.tsx ./node_modules/@storybook/addon-knobs/dist/preset/addDecorator.js ./.storybook/generated-entry.js
2020-04-20T14:00:35.5221851Z (node:163) UnhandledPromiseRejectionWarning: [object Object]
2020-04-20T14:00:35.5222644Z (node:163) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
2020-04-20T14:00:35.5223236Z (node:163) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2020-04-20T14:00:35.5580280Z npm ERR! code ELIFECYCLE
2020-04-20T14:00:35.5585246Z npm ERR! errno 1
2020-04-20T14:00:35.5602967Z npm ERR! [email protected] build-storybook: `npm run generateTypes && build-storybook -s public`
2020-04-20T14:00:35.5603219Z npm ERR! Exit status 1
2020-04-20T14:00:35.5603347Z npm ERR!
2020-04-20T14:00:35.5603669Z npm ERR! Failed at the [email protected] build-storybook script.
2020-04-20T14:00:35.5603823Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-20T14:00:35.5662261Z
2020-04-20T14:00:35.5664818Z npm ERR! A complete log of this run can be found in:
2020-04-20T14:00:35.5665464Z npm ERR! /github/home/.npm/_logs/2020-04-20T14_00_35_560Z-debug.log
2020-04-20T14:00:35.5863724Z ##[error]Process completed with exit code 1.
System:
We tried the following systems:
CI (GitHub Actions):
OS: Ubuntu 18.04.4
Node: 13.13.0 (❌ fails)
Storybook (React): 5.3.17
Local (Windows):
OS: Windows 10 Pro 1909
Node: 10.16.3 (✔️ succeeds), 12.16.2 (✔️ succeeds), 13.13.0 (❌ fails)
Storybook (React): 5.3.17
cc @ndelangen
I found the same problem while trying to build marktext and it also builds fine with Node 12.16.2. I suppose it's an upstream bug.
Is there an issue upstream we can track?
I did not found a related issue at github/babel-loader. I tried without sucess to build with babel-loader 8.1.0 (latest). Would be create if someone with more experience with these tools opened one.
npm update
resolved this problem for me. I assume the problem is in CRA hidden packages
I had the same error message with a laravel & bootstrap-vue app.
npm update
did not help. But, what did was deleting node_modules folder & package-lock.json & updating the one package in package.json, which had compat-data as dependency.
The update was not obvious at first: I removed the third number in the versioning tag.
I assume, @babel/compat-data is compatible with node 13.13 in version 7.9.0 but not in version 7.8.6.
@Sandman83 By the way, I also had to delete the node_modules
andpackage-lock.json
.
Removing node_modules
and yarn.lock
and using node 13.13 has been helped for me.
Had this issue today, removing node_modules and package-lock.json worked for me.
I removed node_modules
as @mckrava said and used NodeJS v12 and it worked.
This error has appeared to me when I ran yarn serve
in my Vue app.
Thanks to @mckrava, removing both node_modules
and yarn.lock
and running yarn
did help.
In my case updating @babel/preset-env
from ^7.8.7
to ^7.9.0
helped ♥️
Try npm update
If this doesn't work, try updating the following, delete the node_modules
directory and run npm install
"@babel/core": "^7.7.2
to @babel/core": "^7.9.0"
"@babel/preset-env": "^7.7.1
to @babel/preset-env": "^7.9.5"
Hope this works
In my case updating
@babel/preset-env
from^7.8.7
to^7.9.0
helped ♥️
how did u figure this out dude , it finally helped me thanks alot
Had this issue today, removing node_modules and package-lock.json worked for me.
Thanks it works for me!
In my case updating
@babel/preset-env
from^7.8.7
to^7.9.0
helped ♥️
thx a lot sir, it work for me
I found that error when the node bumped up from 12.16.1 to 12.17.0
I fixed my problem by removing the 2 entries from @babel/compat-data
in the yarn.lock
and by launching a yarn
to deduplicate.
Since only solutions but no reasons were mentioned in here so far (I was wondering which solution is the right one because of this), I thought I should point it out.
This issue leads to the fact that babel relied on node behavior that was actually a bug. Then that bug got fixed in Node and the babel package started exhibiting this issue. And so I would recommend to upgrade @babel/preset-env
to 7.9.0
and refer to the PR in the babel repo instead of this issue right here.
我也遇到了这个问题 , 仅仅删除 node_modules 没有用, 还得删除 package-lock.json 文件才行
yarn add @babel/preset-env -D
In my case updating @babel/preset-env from ^7.11.5 helped
Most helpful comment
Removing
node_modules
andyarn.lock
and using node 13.13 has been helped for me.