Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Create React App using Yarn 2?

In yarn v1 we initialize create react app using yarn create react-app my-app. How to initialize the same in yan v2.

The above command gives the error

Usage Error: No project found in <<directory>>

$ yarn run <scriptName> ...
like image 980
Ramesh Avatar asked Jan 30 '20 11:01

Ramesh


1 Answers

Check your yarn version:

yarn --version

If it's below 1.22 you may need to upgrade it to use yarn 2:

npm install -g yarn

You can then create your app:

yarn create react-app my-app
cd my-app
yarn set version berry
yarn
yarn start

This should have your react app up and running using yarn 2. You may want to remove the node_modules folder:

rm -R node_modules

Also, you need the next line on .yarnrc.yml

nodeLinker: "node-modules"
like image 102
jclyons52 Avatar answered Sep 22 '22 12:09

jclyons52