alex
alex

Reputation: 147

How to convert a project from npm to yarn by default

My project was initialized using npm and for a long time I had been working with npm, now I wanted to switch to yarn, since this solves some problems, the question is how to create-react-app so that by default it offers to update using yarn instead of npm

That is, yes, I can update my packages with yarn, but I would like create-react-app itself to offer an update using yarn

Upvotes: 1

Views: 1533

Answers (3)

alex
alex

Reputation: 147

I just delete npm from my project and leave only yarn localy and its work fine

Upvotes: 0

Damian Peralta
Damian Peralta

Reputation: 1876

First, you need to have yarn installed in your computer. Follow instruction on https://classic.yarnpkg.com/en/docs/install

Then, create-react-app will use yarn by default, as explained here: https://create-react-app.dev/docs/getting-started/#selecting-a-package-manager

Note: If you are trying to update an already existing app, then delete package-lock.json and node_modules, and install dependencies again with yarn:

rm -rf node_modules
rm package-lock.json
yarn install // will create a new yarn.lock file

Upvotes: 3

jo-chris
jo-chris

Reputation: 412

Did you try:

yarn create <starter-kit-package> [<args>]

e.g:

$ yarn global add create-react-app

https://classic.yarnpkg.com/en/docs/cli/create/

Upvotes: 0

Related Questions