Skip to content

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

Open
@lixiaoyan

Description

@lixiaoyan

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions