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: [
        'css/styles-m',
        'css/styles-l'
    ],
    dsl: 'less'
}

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

有帮助吗?

解决方案

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?

许可以下: CC-BY-SA归因
scroll top