Skip to content

lerna bootstrap --hoist doesn't work with create-react-app 5 #3051

@chris-unlikelyai

Description

@chris-unlikelyai

Expected Behavior

I should be able to use lerna bootstrap --hoist with an application created using create-react-app version 5.

Current Behavior

I get the error

Plugin "react" was conflicted between "package.json » eslint-config-react-app » /Users/cw/dev/cra-test/root/packages/app1/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /Users/cw/dev/cra-test/root/node_modules/eslint-config-react-app/base.js"

when running npx lerna run build after setting up a brand new CRA application with Lerna.

Steps to Reproduce

Use create-react-app to create a single package lerna repo, use npx lerna bootstrap --hoist, then npx lerna run build fails with an error:

mkdir root
cd root
npm init --yes
mkdir packages
cd packages
npx create-react-app app1
cd ..
npx lerna init
npx lerna bootstrap --hoist
npx lerna run build

lerna notice cli v4.0.0
lerna info Executing command in 1 package: "npm run build"
lerna ERR! npm run build exited 1 in 'app1'
lerna ERR! npm run build stdout:

> app1@0.1.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Plugin "react" was conflicted between "package.json » eslint-config-react-app » /Users/cw/dev/cra-test/root/packages/app1/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /Users/cw/dev/cra-test/root/node_modules/eslint-config-react-app/base.js".


lerna ERR! npm run build exited 1 in 'app1'

This works with just npx lerna bootstrap (i.e. without the --hoist).

lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "0.0.0"
}

Context

I want to upgrade to CRA 5! 🙂

Your Environment

Executable Version
lerna --version 4.0.0
npm --version 8.1.2
node --version v16.13.1
OS Version
macOS Big Sur 11.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: package managementIssues with the bootstrap/add/link commands that relate to package management

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions