1

I am using Magento2 version CE-2.2.4 i installed npm,grunt on fresh project but when i am running command

grunt exec:theme

then it create an error Loading "Gruntfile.js" tasks...ERROR

SyntaxError: Unexpected token { Warning: Task "exec:theme" not found. Use --force to continue.

I have tried by using force command but did not work.

1 Answer 1

0

It seems like you have not defined your theme registration for grunt.

Go to dev\tools\grunt\configs\themes.js file from your root directory:

And assign your theme cofiguration as shown below:

Themename: {
        area: 'frontend',
        name: 'theme/Themename',
        locale: 'en_US',
        files: [
            'css/styles-m',
            'css/styles-l'
        ],
        dsl: 'less'
    },

Then run your command again.

5
  • I have already added my new theme in theme.js file but no luck! Oct 11, 2018 at 10:38
  • Please check if your theme name does not have hyphen(-) or underscore(_) Oct 11, 2018 at 10:50
  • yes no hyphen(-) and underscore(_) i tried on fresh m2 installation but not wokring with grunt. Oct 11, 2018 at 10:52
  • Okay do one thing, go to your root directory. There should be a file "Gruntfile.js.sample". Rename it with Gruntfile.js. then try Oct 11, 2018 at 11:05
  • I already did this we need to rename file on root Gruntfile.js,package.json and grunt-config.json. Oct 11, 2018 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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