question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build fails after eject: Cannot find module '@babel/plugin-transform-react-jsx'

See original GitHub issue

Is 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

  1. npx create-react-app project
  2. cd project
  3. yarn eject
  4. 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:open
  • Created 5 years ago
  • Reactions:69
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

81reactions
LinkChenzycommented, Jan 3, 2019

I just met this issue,delete the whole node_modules, and re-yarn it to succeed.

50reactions
lixiaoyancommented, Dec 28, 2018

@Timer No, re-run yarn doesn’t help. I need to delete the whole node_modules and re-install all packages. I think it might be a bug in yarn package manager but I’m not sure.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found