Error when compiling standard theme

Hello everybody!

We are trying to compile the standard theme using command ‘php bin/console theme:compile’ but we are getting this error:

php bin/console theme:compile
Start theme compilation
07:53:49 ERROR     [console] Error thrown while running command “theme:compile”. Message: “Undefined variable $spacer: /…/vendor/shopware/storefront/Resources/src/style/abstract/variables/_custom.scss on line 19, at column 1” [“exception” => ScssPhp\ScssPhp\Exception\CompilerException^ { …},“command” => “theme:compile”,“message” => “Undefined variable $spacer: /…/vendor/shopware/storefront/Resources/src/style/abstract/variables/_custom.scss on line 19, at column 1”]

In Compiler.php line 4184:

Undefined variable $spacer: /…/vendor/shopware/storefront/Resources/src/style/abstract/variables/_custom.scss on line 19, at column 1

theme:compile [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]


We did check the file and the variable is missing. If we add it and try to compile again another errors are thrown(mix-in…). 

The zip file from the site is already coming with the theme compiled. 

Seems that the .scss files for default theme are incomplete in vendor.

Does anyone have an ideea how to achieve compilation of the standard theme?

Best regards,

Sorin Fistoc



the error you describe occurs if Shopware is unable to resolve the bootstrap dependency. The spacer variable and the mix-in is normally defined by bootstrap. Are you using the installation package from our website or have you checked out the code from GitHub?

Which command prior to bin/console theme:compile have you executed?


Thank you for the quick answer.

We are using the installation package from your website. 

We tried to execute bin/console theme:refresh before.


I’ve tried to run this commands:

npm --prefix vendor/shopware/storefront/Resources/ clean-install    [this worked and installed all dependencies]

I’ve tried after that to run again ‘bin/console theme:compile’ but I get the same error.

Based on installation steps from developer edition I’ve runned this command too:

npm --prefix vendor/shopware/storefront/Resources/ run production

This is throwing the following error:

Error: Cannot find module ‘@shopware/webpack-copy-after-build’
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)

Can anyone help on this issue?

Thank you in advance and best regards,


Hello everybody!

I finnally managed to get it work and I’ll post the solution here:

After a clean project git setup(from github) or from the installation zip file available on the site(but using the .gitignore file from github) following steps must be done:

1. Install administration dependencies:

npm clean-install --prefix vendor/shopware/administration/Resources

npm clean-install --prefix vendor/shopware/administration/Resources lerna – bootstrap

  1. Build administration:

php bin/console bundle:dump
PROJECT_ROOT=__ABSOLUTE_PATH_TO_PROJECT_ROOT__ npm run --prefix vendor/shopware/administration/Resources/administration/ build
php bin/console assets:install

  1. Install storefront dependencies:

npm --prefix vendor/shopware/storefront/Resources/ clean-install
node vendor/shopware/storefront/Resources/copy-to-vendor.js

  1. Build storefront:

php bin/console bundle:dump
PROJECT_ROOT=__ABSOLUTE_PATH_TO_PROJECT_ROOT__/ npm --prefix vendor/shopware/storefront/Resources/ run production
php bin/console theme:compile
php bin/console assets:install

  1. Change theme:

php bin/console theme:change Storefront --all

Running ‚PROJECT_ROOT=__ABSOLUTE_PATH_TO_PROJECT_ROOT__/ npm --prefix vendor/shopware/storefront/Resources/ run‘ you’ll see options like ‚watch‘

If ‚clean-install‘ doesn’t work try to use ‚install‘ instead.


Best regards,



1 Like

We’ve got into the same problem with development repo, but only this was necessary to fix it:

appuser@93fa24b83550:/app$ node /app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/copy-to-vendor.js

  • copied „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/tiny-slider“ to „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/vendor/tiny-slider“
  • copied „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/jquery“ to „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/vendor/jquery“
  • copied „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/flatpickr“ to „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/vendor/flatpickr“
  • copied „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/bootstrap“ to „/app/vendor/shopware/platform/src/Storefront/Resources/app/storefront/vendor/bootstrap“

✓ Done, all directories / files copied successfully.
Execution time: 373.4345ms
appuser@93fa24b83550:/app$ bin/console theme:compile
Start theme compilation

! [NOTE] Took 7.168253 seconds


or probably running ./psh.phar storefront:init would’ve solved it, as this step is included in