React Native dependencies
npm and Yarn are both package managers for Node.js. They can manage the dependencies of a project, or globally installed Javascript tools. For mobile development, they are frequently used as package managers for React Native projects. If you have a React Native app on Bitrise, you can use our dedicated npm or Yarn Steps to install and cache your dependencies.
You can also install native dependencies by using the dedicated Steps: see topic.
Installing dependencies with npm and YarnClick to copy link
- npm
- Yarn
-
Make sure your project has a package.json file defined in it.
-
Add the Run npm command Step to your Workflow.
-
Set the The npm command with arguments to run to
install.You can add additional options to the
installcommand. For example, if you need to link a library with native dependencies to your React Native project, use the--saveor--save-devflag. For the available options, see the npm documentation.
-
Optionally, you can set the npm version that will run the
npm installcommand in the Version of npm to use input.
-
Make sure your project has a package.json file defined in it.
-
Add the Run yarn command Step to your Workflow.
-
Set the Yarn command to run to
install. -
Optionally, add arguments to the yarn command in the Arguments for running yarn commands.
You can specify multiple arguments, separated by a space.
Caching npm and Yarn dependenciesClick to copy link
With key-based caching, you only need the Restore NPM cache and the Save NPM cache Steps to cache your node modules. These Steps require no configuration as they automatically set up the cache keys needed for your dependencies.
-
Add the Restore NPM cache Step to the start of your Workflow.

-
Add the Save NPM cache Step to the end of your Workflow.
Installing native dependencies for a React Native appClick to copy link
You might need to install native dependencies that are declared in the ios and android folders. For example, CocoaPods dependencies defined in a Podfile. You can do this quite easily on Bitrise, too: once you bundle your React Native app to be ready to build the Android and iOS binaries, you can simply use the dependency manager Steps for Android and iOS apps.
Check out our React Native demo app for a working example. If you add the app to Bitrise, you can see that the deploy-ios-release Workflow, for example, contains both the Run npm command and the Run CocoaPods install Steps, to install both npm packages and pods: React Native demo app.
-
Make sure your Workflow installs your npm packages: see topic.
You can have a separate Workflow that is only responsible for installing npm packages, and it's inserted to run before your main Workflow: Chaining Workflows together. It can be a utility Workflow.
-
Add the React Native Bundle Step to your Workflow.
It must come after the npm packages are installed.
-
Add the required dependency manager Steps or build Steps to the Workflow. The exact Steps you need depend on the project type and the dependency manager you use: