Skip to content

npx create-react-app throws error when using in monorepo #5195

Open
@FelixKuehl

Description

@FelixKuehl

Is this a bug report?

Maybe.
I know monorepos are not fully supported, however i would expect this to work.

Did you try recovering your dependencies?

Yes

Environment

Node v8.11.3
yarn 1.10.1
npx 6.4.1

Steps to Reproduce

(Write your steps here:)

  1. Create a lerna / yarn workspaces repo
  2. naviagte to packages folder
  3. run create-react-app@next --scripts-version=@next cra-app

Expected Behavior

It should create a new create react app.

Actual Behavior

When running create-react-app@next --scripts-version=@next cra-app, I am getting the following error:

{ Error: Cannot find module '/Users/felixkuehl/cra-monorepo/packages/cra-app/node_modules/react-scripts/package.json'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at checkNodeVersion (/Users/felixkuehl/.npm/_npx/66044/lib/node_modules/create-react-app/createReactApp.js:543:23)
    at getPackageName.then.then.then.packageName (/Users/felixkuehl/.npm/_npx/66044/lib/node_modules/create-react-app/createReactApp.js:344:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }

This could maybe due to yarn workspaces package hoisting.

Workaround is to just run create-react-app@next --scripts-version=@next cra-app outside the monorepo, then delete the node_modules folder and copy the new app into the monorepo.
Anyways, keep up the great work! ;)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions