Shopify CLI as a global or local dependency for apps
Shopify CLI can be globally installed or used as a local dependency when working with Shopify apps. This documentation explains the reasons for using each installation method and the process for switching between them.
Switch to a global Shopify CLI executable
Anchor link to section titled "Switch to a global Shopify CLI executable"Global installation is the default recommended approach for using Shopify CLI. Global installation has the advantage of a single install and upgrade point for all your Shopify app, theme, and Hydrogen development.
If you have an existing app which has Shopify CLI as a local dependency in its package.json
, use the following steps to move to a global install:
Use your package manager to delete
@shopify/cli
and (if present)@shopify/app
from your dependencies:Install Shopify CLI as a global package.
Invoke Shopify CLI directly when working in your app. For example:
Switch an app to a local Shopify CLI dependency
Anchor link to section titled "Switch an app to a local Shopify CLI dependency"Adding Shopify CLI as a local dependency is useful if you wish to synchronize Shopify CLI versions within a team, or use different Shopify CLI versions across multiple apps in your development environment.
To switch an app to use Shopify CLI as a local dependency:
Install the
@shopify/cli
package with one of the following commands.Invoke Shopify CLI commands with your package manager. For example: