0

When running npm init react-app npm is choosing yarn as the default package manager for the created app. I have deleted yarn from my computer using boj answer in How Do I Uninstall Yarn.

Minimum reproducible example:

$ npm -v
6.14.5
$ npm init react-app my-app
npx: installed 98 in 13.198s

Creating a new React app in ./my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.9.4
...
$ cd my-app
my-app/$ ls
node_modules  package.json  yarn.lock  public  README.md  src

As you can see there is a yarn.lock file and yarn add v1.9.4 was used for installing the packages. Is this the default npm behaviour right now as npm V6.14.5? If yes it would be great to know if there were a reference where I could find the reasons for choosing yarn as the default.

Matias Haeussler
  • 1,061
  • 2
  • 12
  • 25
  • Does it cause any problem or change and make app behave in a different way? –  May 07 '20 at 14:28

3 Answers3

2

It's just a preference of react-app creators. BTW, you can use --use-npm in case that you would prefer to use npm.

Alex
  • 4,621
  • 1
  • 20
  • 30
  • Do you have any reference of them stating that preference? – Matias Haeussler May 07 '20 at 14:30
  • 1
    @MatiasHaeussler The existing behavior indicates this preference. What to choose `npm` or `yarn` is quite similar to `Nikon` vs `Canon` battle. In your case the difference is negligible. – Alex May 08 '20 at 09:23
0

A reason could be that yarn is built with the Facebook team, so they would want to use it over npm.

You can use --use-npm if you prefer npm:

create-react-app my-project --use-npm

If the project is already created, try deleting yarn.lock

Antonio MG
  • 20,382
  • 3
  • 43
  • 62
0

You can use npx create-react-app project-name --use-npm in order to default to npm