# Error when compiling standard theme

**URL:** <https://forum.shopware.com/t/error-when-compiling-standard-theme/60676>\
**Category:** Themes & Design\
**Created:** [26. Juli 2019 um 07:06 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676 "2019-07-26T07:06:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SorinSologics2019](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SorinSologics2019](https://forum.shopware.com/u/SorinSologics2019)\
**Post date:** [26. Juli 2019 um 07:06 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/1 "2019-07-26T07:06:09Z")

</div>

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 &nbsp; &nbsp; [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] [–]

&nbsp;

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…).&nbsp;

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

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  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Jens\_K](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@Jens\_K](https://forum.shopware.com/u/Jens_K)\
**Post date:** [26. Juli 2019 um 07:19 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/2 "2019-07-26T07:19:14Z")

</div>

Hello,

&nbsp;

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&nbsp;bin/console theme:compile have you executed?

---

<div class="post-metadata">

**Author:** ![SorinSologics2019](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SorinSologics2019](https://forum.shopware.com/u/SorinSologics2019)\
**Post date:** [26. Juli 2019 um 07:24 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/3 "2019-07-26T07:24:06Z")

</div>

Hello,

Thank you for the quick answer.

We are using the installation package from your website.&nbsp;

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

---

<div class="post-metadata">

**Author:** ![SorinSologics2019](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SorinSologics2019](https://forum.shopware.com/u/SorinSologics2019)\
**Post date:** [26. Juli 2019 um 10:41 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/4 "2019-07-26T10:41:09Z")

</div>

Hello,

I’ve tried to run this commands:

npm --prefix vendor/shopware/storefront/Resources/ clean-install&nbsp; &nbsp; [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’  
&nbsp; &nbsp; at Function.Module.\_resolveFilename (internal/modules/cjs/loader.js:636:15)  
&nbsp; &nbsp; at Function.Module.\_load (internal/modules/cjs/loader.js:562:25)  
&nbsp; &nbsp; at Module.require (internal/modules/cjs/loader.js:690:17)  
…

Can anyone help on this issue?

Thank you in advance and best regards,

Sorin

---

<div class="post-metadata">

**Author:** ![SorinSologics2019](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SorinSologics2019](https://forum.shopware.com/u/SorinSologics2019)\
**Post date:** [26. Juli 2019 um 13:33 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/5 "2019-07-26T13:33:12Z")

</div>

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.&nbsp;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\_\_&nbsp;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.

&nbsp;

Best regards,

Sorin

&nbsp;

---

<div class="post-metadata">

**Author:** ![razvanphp](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@razvanphp](https://forum.shopware.com/u/razvanphp)\
**Post date:** [4. April 2021 um 01:17 UTC](https://forum.shopware.com/t/error-when-compiling-standard-theme/60676/6 "2021-04-04T01:17:20Z")

</div>

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$  
> appuser@93fa24b83550:/app$  
> appuser@93fa24b83550:/app$ bin/console theme:compile  
> Start theme compilation
> 
> ! [NOTE] Took 7.168253 seconds
> 
> appuser@93fa24b83550:/app$

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