Skip to content

Add a flag to force create-react-app to use a specific package manager #2809

Closed

Description

@leojiang

Background:

create-react-app uses yarn as the default installation tool if it is found in the environment.
source code: line 195 in createReactApp.js

There're two special situation:

  1. When using yarn, if the registry registry.yarnpkg.com cannot be reached with dns.lookup, then yarn will switch to offline mode and try to use local cache. But I don't have any cached modules at all. Then it goes to a dead end!!
    source code: line 616 in createReactApp.js

  2. Anyway for situation no.1, uninstall yarn can solve the problem and npm is used instead. But I need to use npm and yarn both and I can't uninstall yarn. It goes to a dead end again!!!

So, Is it possible to add a parameter for user to specify which installation tool(yarn/npm) to be used dynamically?

Thanks!

Activity

  1. changed the title [-]Is it possible to add a parameter for user to specify installation tool(yarn/npm) dynamically?[/-] [+]Add a flag to force create-react-app to use npm[/+] on Jan 8, 2018
  2. added this to the 1.x milestone on Jan 8, 2018
  3. gaearon commented on Jan 8, 2018

    @gaearon
    Contributor

    I'd be happy to take a PR that lets you pass something like create-react-app --pm=npm or create-react-app --pm=pnpm and it will use that manager.

  4. changed the title [-]Add a flag to force create-react-app to use npm[/-] [+]Add a flag to force create-react-app to use a specific package manager[/+] on Jan 8, 2018
  5. gaearon commented on Jan 14, 2018

    @gaearon
    Contributor

    Actually, just realized we already support --use-npm flag. I think this is probably enough for now. It was added in #3409 and hasn't been released yet but we can close this.

  6. vjpr commented on Feb 19, 2018

    @vjpr

    I still think we should allow --pm=pnpm.

  7. Timer commented on Feb 26, 2018

    @Timer
    Contributor

    Feel free to submit a PR @vjpr, I'd be happy to review it.

  8. locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions