1

Already follow from this dev document this

1.npm install -g grunt-cli

2.Rename 3 files - package.json.sample into package.json - Gruntfile.js.sample into Gruntfile.js - grunt-config.json.sample into grunt-config.json

3.cd your_Magento_instance_directory npm install npm update

4.adding themes in dev/tools/grunt/configs themes.js

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

however Im using linux ubuntu 16.0, Im running command grunt in magento root folder

Loading "Gruntfile.js" tasks...ERROR

Error: Cannot find module '/home/user/www/tutor/dev/tools/grunt/configs/local-themes' Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

anybody know about this error.

Thanks

  • Could you please mentioned the command you are running. – Saphal Jha May 8 at 4:45
  • @SaphalJha in root my magento2 $grunt – Keep in touch May 8 at 4:48
  • Is simple 'grunt' command is working? – Chandra Prakash Gupta May 8 at 5:53
  • i tried $grunt only error Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected token { Warning: Task "default" not found. Used --force, continuing. i tried also $grunt --force still same error – Keep in touch May 8 at 5:55
0

Please do not rename this, keep it as default :

grunt-config.json.sample

Now try again, if not working then add --force after your command

  • already rename it to default grunt-config.json.sample, in my magento root my command $grunt but still error Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected token { Warning: Task "default" not found. Used --force, continuing. Done, but with warnings. already add --force in my command still same $grunt --force – Keep in touch May 8 at 4:57
  • Did you tried above solution. – Saphal Jha May 8 at 5:05
  • Im already tried as your suggestion but still error – Keep in touch May 8 at 5:24
0

Define Like this :-

<theme>: {
     area: 'frontend',
     name: '<Vendor>/<theme>',  // app/Design/Frontend/Vendor/Theme/ 
     locale: '<language>',
     files: [
         'css/styles-m',
         'css/styles-l'
     ],
     dsl: 'less'
     }
  • already my define as my first description – Keep in touch May 8 at 5:35
  • change "default" to your "theme name" – Rk Rathod May 8 at 5:43
  • my theme name is default :D and my vendor is Tutor – Keep in touch May 8 at 5:45
  • re-installing grunt "sudo npm install grunt" – Rk Rathod May 8 at 5:56
  • i did re-installing stiil same error – Keep in touch May 8 at 6:00
0

please check the file "grunt-config.json" file in your project root folder. following code should be there:

{
    "themes": "dev/tools/grunt/configs/local-themes"
}

Also, please check the location /home/user/www/tutor/dev/tools/grunt/configs

There will be the file is "themes.js", please rename it to "local-themes.js"

flush the cache

Please check now and let me now if its working. However, I am sure it will be working for you.

Thanks

  • Im already follow your steps still error dude Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected token { Warning: Task "default" not found. Use --force to continue. Aborted due to warnings. – Keep in touch May 8 at 6:12
0

Here is process for installing grunt:

First Rename files from root directory - package.json.sample into package.json - Gruntfile.js.sample into Gruntfile.js

  1. Install NodeJs from https://nodejs.org/
  2. Once you have Node install properly run command: "sudo npm install -g grunt-cli"
  3. Go to your project dir. then run command: "sudo npm install grunt --save-dev"
  4. then: "npm install"
  5. Now run command "grunt"
  • 1 already install my node js is v4.2.6 2 already install also mya grunt is grunt-cli v1.3.2 and grunt v1.0.4 3.already running sudo npm install grunt --save-dev and also npm install when running command $grunt error like this - Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected token { Warning: Task "default" not found. Use --force to continue. Aborted due to warnings. – Keep in touch May 8 at 6:19
0

Alhamdulillah, my issues solve I just updating my nodejs, because my nodjs before the old one so im updating

  1. sudo npm install -g n
  2. sudo n latest

Done, I can run $grunt , $grunt exec:mytheme

Thanks you all for any sugestion :D

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.