BABEL error when running `yarn` in create-react-app
See original GitHub issueIs this a bug report?
Yes
Did you try recovering your dependencies?
Yes
yarn --version 1.5.1
Which terms did you search for in User Guide?
(Write your answer here if relevant.)
Environment
node -v
: v8.9.4npm -v
: 5.6.0yarn --version
(if you use Yarn): 1.5.1npm ls react-scripts
(if you haven’t ejected): └── react-scripts@1.1.0 -> /Users/fratran/projects/create-react-app/packages/react-scripts extraneous
npm ERR! extraneous: react-scripts@1.1.0 /Users/fratran/projects/create-react-app/node_modules/react-scripts
Then, specify:
- Operating system: OSX Sierra 10.12.6
- Browser and version (if relevant):
Steps to Reproduce
(Write your steps here:)
- Clone CRA into a new folder (
git clone https://github.com/facebook/create-react-app.git
) - Go to the created directory (
cd create-react-app
) - Run Yarn (
yarn
)
Expected Behavior
node_modules folder gets generated, dependencies download without error, compiling iframeScripts.js finishes without error.
Actual Behavior
Failed to compile
message occurs when compiling iframeScript.js followed by the following error
Compiling iframeScript.js
Failed to compile.
ERROR in ./src/iframeScript.js
Module build failed: TypeError: [BABEL] /Users/fratran/projects/create-react-app/packages/react-error-overlay/src/iframeScript.js: Cannot read property 'slice' of undefined (While processing: "/Users/fratran/projects/create-react-app/node_modules/babel-preset-react-app/index.js$3")
at throwVersionError (/Users/fratran/projects/create-react-app/node_modules/@babel/helper-plugin-utils/lib/index.js:41:15)
at Object.assertVersion (/Users/fratran/projects/create-react-app/node_modules/@babel/helper-plugin-utils/lib/index.js:11:11)
at /Users/fratran/projects/create-react-app/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js:15:7
at /Users/fratran/projects/create-react-app/node_modules/@babel/helper-plugin-utils/lib/index.js:16:12
at /Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:167:14
at cachedFunction (/Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/caching.js:40:17)
at loadPluginDescriptor (/Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:202:28)
at /Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:59:16
at Array.map (<anonymous>)
at recurseDescriptors (/Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:58:36)
at recurseDescriptors (/Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:92:27)
at loadConfig (/Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/config/index.js:108:6)
at /Users/fratran/projects/create-react-app/node_modules/@babel/core/lib/transform.js:26:33
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
✨ Done in 4.52s.
✨ Done in 31.53s.
Reproducible Demo
You can reproduce this with this base repo, and I’ve experienced it on multiple coworker’s computers.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:8 (3 by maintainers)
Top Results From Across the Web
babel-preset-react-app dependency error - Yarn 3 #11793
Describe the bug When attempting to use create-react-app with yarn 3, running the scripts returns the following error Error: [BABEL] ...
Read more >react-scripts babel scripts error running with yarn on local ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >How to resolve create-react-app babel-jest Error. - Medium
After creating my react app using the official create-react app. ... Run npm install or yarn, depending on the package manager you use....
Read more >Create React App without Create React App - Bits and Pieces
Babel — used to convert ECMAScript 2015+ (ES6+) code into a backwards compatible version of JavaScript that can be run by older JavaScript...
Read more >Getting Started - Create React App
If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For some context, in beta.41 we added a way for plugins to check/assert what version of Babel they’re being used with and throw a friendlier (irony, lol) error message.
Haven’t dug into this really, but it looks like
proposal-object-rest-spread@beta.41
(from another dep) is getting loaded by CRA’s preset since it doesn’t have an explicit devDep on it.I’ll push a PR to fix.
Just a side note, this is in the default
next
branch. I tried to replicate this inmaster
and it works fine. Here are the results I expected and got:The thing that is really strange though is I had this working in the next branch last night… didn’t turn off my computer or update anything… just deleted the test-app, tried to rerun
yarn create-react-app test-app
to test some changes forreact-scripts
when I first ran into the issue. Since then, I can replicate the issue on every machine I’ve tried by following the steps described above.