I have followed the docs for setting up Less compilation. Running grunt clean and grunt less works without errors, but when I run grunt exec (with or without appending a specific theme name) I get the following error:

Execution Time (2018-03-09 15:33:35 UTC)
loading tasks                55ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 58%
loading grunt-contrib-clean   3ms  ▇▇ 3%
clean:mytheme           37ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇ 39%
Total 95ms

>> Exited with code: 255.
>> Error executing child process: Error: Process exited with code 255.
Warning: Task "exec:mytheme" failed. Use --force to continue.

I've tried so many different things to get this working but to no avail. Has anyone encountered this before?

My dev/tools/grunt/configs/themes.js has this added:

mytheme: {
    area: 'frontend',
    name: 'Mycompany/mytheme',
    locale: 'en_US',
    files: [
    dsl: 'less'

And my Gruntfile.js and package.json files are the same as those included with v2.2.2 (the sample files renamed).

3 Answers 3


Try to use another node version. Node version is 10.10.0 but i returned to 8.12.0 and works.

You can change with this https://github.com/creationix/nvm


In my experience this happens when Grunt can't access the database. Make sure:

  • You are running this from inside your Magento SSH terminal
  • Your Magento instance running and has a working DB

If both of those are true, what happens if you run php bin/magento dev:source-theme:deploy --type=less --locale=en_US --area=frontend --theme=Mycompany/mytheme?


I had a similar issue and it ended up being a memory limit issue with the php.ini file that was used within grunt which ended up being different than the one used in my normal command line environment (I'm running MAMP Pro). I was able to resolve by doing the following...

  1. Edited the the php.ini via MAMP Pro and increased memory_limit
  2. When that didn't work I temporarily edited the file dev/tools/grunt/configs/combo.js on the line command = command + 'php bin/magento dev:source-theme:deploy ' + and replaced with command = command + 'php --ini ' +
  3. Ran $ grunt exec to determine which ini file is being used when the command is run (note that the output will be intermixed with a few other things, but that's okay since it's just for a quick debugging purposes)
  4. Edited the php.ini file identified and increased memory_limit
  5. Reverted debugging changes from combo.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.