Set Up Yarn Workspaces
Yarn Workspaces lets you manage multiple packages or "workspaces" within a single repository. This page describes the process of setting up and using Yarn Workspaces for CLI-based builds in React Native for Vega app and turbo module projects.
The key steps involve:
- Install Yarn
- Configure workspaces
- Integrate
npm-run all - Organize packages
- Build the project
- Use Yarn commands
Install Yarn
Install Yarn, version 3.8.1 or later. For installation instructions, see Yarn installation documentation.
Configure workspaces
-
Create a
.yarnrc.ymlfile in your project’s root folder, for examplekeplerworkspaceapp/. -
Add this configuration:
nodeLinker: node-modules nmSelfReferences: false
Integrate npm-run-all dependency
Complete the following steps:
- Use the
NPM_EXECPATHto set the path to Yarn. -
Set the
NPM_EXECPATHenvironment variable in your.bashrcor.zshrcfile:export NPM_EXECPATH=$(which yarn)You can use
NPM_EXECPATHdirectly at the command prompt when running with Yarn.NPM_EXECPATH=$(which yarn) yarn
Organize packages
If you have the project setup with React Native for Vega apps and turbo modules, skip to Build the project.
To organize packages, complete the following steps:
- In your project’s root folder, create a
packages/folder. -
When you create a React Native for Vega app and a turbo module sub-projects in this workspace project, generate these projects in their own folders under the
packages/folder usingkepler project generatecommands. The project structure looks like this:├── keplerworkspaceapp/ │ ├── package.json │ ├── packages/ │ │ ├── turbo-module/ │ │ │ ├── package.json │ │ │ ├── ... │ │ ├── application/ │ │ │ ├── package.json │ │ │ ├── ... │ │ ├── ... │ ├── ...
Build the project
-
Add scripts to the project’s root package.json.
{ "name": "@amazon-devices/kepler-workspace-app", "version": "0.0.1", " workspaces": { "packages": [ "packages/*" ] }, "scripts": { "build:tm": "yarn workspace '@amazon-devices/<tm-project>' run pack", "build:app": "yarn workspace '@amazon-devices/<app-project>' run build:app", "build": "npm-run-all build:tm build:app" } } -
Add more packages to the project as required. Follow the steps in Organize packages.
Use Yarn commands
To install dependencies and build, use the applicable Yarn commands:
yarn install
yarn build:app
yarn install
yarn build:app
yarn install
yarn pack
For details on using Yarn Workspaces, visit the Yarn Workspaces documentation.
Related topics
Configure Node Package Managers to Work with Vega SDK
Last updated: Nov 13, 2025

