Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #3031
Closed
Open
Issue created Aug 30, 2017 by Administrator@rootContributor

Can't use a CRA project inside Yarn Workspaces

Created by: thomas-jeepe

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

I am using npm 4.6.1 and its a yarn specific bug anyways.

Which terms did you search for in User Guide?

I simply searched the github repo for workspace and yarn workspace I didn't see a relevant error message/issue.

Environment

  1. node -v: 8.4.0
  2. npm -v: 4.6.1
  3. yarn --version: 0.27.5
  4. npm ls react-scripts: Empty (no scripts to use)

Then, specify:

  1. Operating system: OSX El Capitan 10.11.6

Steps to Reproduce

https://github.com/thomas-jeepe/err-demo

  1. mkdir err-demo
  2. cd err-demo
  3. touch .yarnrc
  4. echo "workspaces-experimental true" > .yarnrc
  5. touch package.json
  6. Write
{
  "name": "meme",
  "version": "1.0.0",
  "main": "index.js",
  "private": true,
  "workspaces": ["packages/*"]
}

to package.json 7. mkdir packages 8. cd packages 9. create-react-app test

Or: https://github.com/thomas-jeepe/err-demo/

Expected Behavior

create-react-app would use the tools installed at the workspace level.

Actual Behavior

Doesn't find the tools and just complains:

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module '/Users/PenguinSoccer/code/js/err-demo/packages/test/node_modules/react-scripts/package.json'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at checkNodeVersion (/Users/PenguinSoccer/.config/yarn/global/node_modules/create-react-app/createReactApp.js:476:23)
    at getPackageName.then.then.then.packageName (/Users/PenguinSoccer/.config/yarn/global/node_modules/create-react-app/createReactApp.js:285:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' } 

Reproducible Demo

https://github.com/thomas-jeepe/err-demo/

So, just using regular logic, it seems that create-react-app is unaware about yarn workspaces, which install at the package level node_modules rather than for each individual folder in the workspace.

create-react-app goes for the folder's node_modules when the node_modules are kept in the workspace root.

Although from my understanding, yarn attempts to link node_modules in each directory to the root workspace, so then I don't know what the issue is.

Whether create-react-app should support yarn workspaces is up to you guys and low priority for me, since I probably won't use it anyway (think its a cool project though :))

Assignee
Assign to
Time tracking