Start the application

yarn start or npm run start

This command executes a local deployment of your Magento 2 application. It does it in the following steps:
  1. 1.
    Prepare your project for Magento 2.
  2. 2.
    Install and compile the correct PHP version with required extensions to run Magento 2.
  3. 3.
    Deploy services, Redis, MySQL, ElasticSearch and Nginx, in Docker containers for Magento 2.
  4. 4.
    Install Magento 2 with Composer.
  5. 5.
    Setup Magento 2.
  6. 6.
    Open a browser with up and running Magento 2 store.

Command options

-p, --port

A port to run your application on.
By default, Create Magento App will select a random available port.
1
yarn start --port <port> # for Yarn
2
npm run start -- --port <port> # for NPM
Copied!

-n, --no-open

Disable auto-open of a browser window at the end of the workflow.
1
yarn start --no-open # for Yarn
2
npm run start -- --no-open # for NPM
Copied!

-d, --debug

Enable XDebug for debugging PHP.
1
yarn start --debug # for Yarn
2
npm run start -- --debug # for NPM
Copied!

-s, --skip-setup

Skips Magento setup.
Skipping Magento setup might result in conflict during runtime because Magento config will not be updated with a new port config. This option can be used only if you 100% sure that the ports configuration is the same.
In a nutshell, this option enables start command will just restart services and PHP-FPM, so if you need to restart the project it can be done in under 10 seconds*.
1
yarn start --skip-setup # for Yarn
2
npm run start -- --skip-setup # for NPM
Copied!
* Tested on Ryzen 9 3900x system with NVME SSD with a result in 9.5s.

--import-db

Imports database dump to the MySQL container.
Does the same thing as the import-db command but allows to use it during start, so the project can be bootstrapped from zero in 1 command.
1
yarn start --import-db ./dump.sql # for Yarn
2
npm run start -- --import-db ./dump.sql # for NPM
Copied!

--recompile-php

Sometimes, on macOS when dynamic dependencies are updated, PHP might break. To fix this issue you need to manually delete the PHP binary in ~/.phpbrew/php/php-<version>, so CMA will detect it and compile it. Now, you just need to pass this option in the start command and CMA will take care of everything.
1
yarn start --recompile-php # for Yarn
2
npm run start -- --recompile-php # for NPM
Copied!

-v, --verbose

This option will enable printing of logs from Magento installation, setup and upgrade tasks.
1
yarn start --verbose # for Yarn
2
npm run start -- --verbose # for NPM
Copied!

Usage example

1
yarn start # for Yarn
2
npm start # for NPM
Copied!
Last modified 4mo ago