Build fails after eject: Cannot find module '@babel/plugin-transform-react-jsx'
See original GitHub issueIs this a bug report?
Yes
Environment
Environment Info:
System:
OS: Linux 4.18 Fedora 29 (Workstation Edition) 29 (Workstation Edition)
CPU: x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 10.13.0 - /usr/bin/node
Yarn: 1.12.3 - ~/.npm-packages/bin/yarn
npm: 6.4.1 - /usr/bin/npm
Browsers:
Chrome: 70.0.3538.102
Firefox: 63.0.1
npmPackages:
react: ^16.7.0 => 16.7.0
react-dom: ^16.7.0 => 16.7.0
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
Steps to Reproduce
npx create-react-app project
cd project
yarn eject
yarn build
Expected Behavior
Build success.
Actual Behavior
Build fails.
Creating an optimized production build...
Failed to compile.
./src/index.js
Error: [BABEL] /tmp/project/src/index.js: Cannot find module '@babel/plugin-transform-react-jsx' (While processing: "/tmp/project/node_modules/babel-preset-react-app/index.js$1")
at Array.reduce (<anonymous>)
After eject, there’s no @babel/plugin-transform-react-jsx
module inside ./node_modules
, ./node_modules/babel-preset-react-app/node_modules
or ./node_modules/babel-preset-react-app/node_modules/@babel/preset-react/node_modules
.
I need to delete the whole node_modules
and re-run yarn
to make it work.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:69
- Comments:30 (13 by maintainers)
Top Results From Across the Web
Cannot find module '@babel/plugin-transform-react-jsx-source'
Run the script, which was failing before (in your case most likely: yarn start or npm start ). Share.
Read more >Cannot find module '@babel/plugin-transform-react-jsx-source ...
After you execute npm run eject : cd /your/project/path (ignore); rm -rf node_modules; npm install or yarn install; Run the script, which was...
Read more >@babel/plugin-transform-react-jsx - npm
Turn JSX into React function calls. Latest version: 7.20.7, last published: 4 days ago. Start using @babel/plugin-transform-react-jsx in ...
Read more >expo failed to resolve plugin for module - You.com | The AI ...
Expo is unable to resolve the react-native-email-link plugin. ... the readme here but attempting to run an eas build results in the following...
Read more >Cannot find module '@babel/core', Programmer ... - ADocLib
src/main.js Module build failed: Error: Cannot find module 安裝相應組件: npm install babel-plugin-syntax-jsx --save-dev React create-react-app Build fails after ...
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 Hashnode Post
No results found
Top GitHub Comments
I just met this issue,delete the whole node_modules, and re-yarn it to succeed.
@Timer No, re-run
yarn
doesn’t help. I need to delete the wholenode_modules
and re-install all packages. I think it might be a bug in yarn package manager but I’m not sure.