DEV Community

Kyle Schwartz
Kyle Schwartz

Posted on

Migrate a JS Project to Yarn Berry

For this tutorial, you will need a starting project. The assumption is that there is no lock file and the project is not installed (i.e. no node_modules folder). I will be starting with a blank Vite project. You can create one by running the command below and following the prompts:

yarn create vite
Enter fullscreen mode Exit fullscreen mode

If you don't have Yarn berry installed, run one of the following commands:

# Node >=16.10 - May have to run as admin
corepack enable
Enter fullscreen mode Exit fullscreen mode
# Node <16.10
npm i -g corepack
Enter fullscreen mode Exit fullscreen mode

Once completed, open the project. Now, run the following commands in sequence:

yarn set version berry
yarn
yarn dlx @yarnpkg/sdks vscode # If using vscode/vscodium
Enter fullscreen mode Exit fullscreen mode

All done!

Top comments (0)