2

I am running grunt exec:luma and am getting the following errors:

Processed Area: frontend, Locale: en_GB, Theme: Magento/luma, File type: less.

>>   [Zend_Db_Adapter_Exception]
>>   SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
>>
>>
>>   [PDOException]
>>   SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
>>
>>
>>
>> dev:source-theme:deploy [--type="..."] [--locale="..."] [--area="..."] [--theme="..."] [file1] ... [fileN]
>> Exited with code: 255.
Warning: Task "exec:luma" failed. Use --force to continue.

Aborted due to warnings.

enter image description here

Steps I have taken are as follows:

  1. Clean theme by command: grunt clean

  2. run command: grunt exec:yourthemename

I don't have a clue why I am getting a DB error can anyone shed any light into this. DB credentials I'm just confused as to why the Grunt task would be even interacting with the DB.

My Magento 2 set up is running on an Nginx server

2 Answers 2

4

grunt exec is esentially a shorthand for clearing the folders var/view_preprocessed, var/generation, var/log/system.log and pub/static and running

php bin/magento dev:source-theme:deploy --type=less --locale=en_US --area=frontend --theme=Package/theme

So before running grunt commands you need to make sure that your comand line php is the same as the server php and that it has access to the database. You get that error because your comand line php does not have access to the database. Also make sure that the user with which you are running grunt has access to delete the var and pub/static volders.

3
  • 1
    Cheers for the explanation! As im running M2 on a virtual machine I need to run grunt commands when I am SSH'd into my virtual machine.
    – Bobadevv
    Jun 9, 2016 at 9:00
  • @Bobadevv yes, found that the hard way myself. are you using an open source vagrant box? having issues finding a good one. Jun 9, 2016 at 9:00
  • I am using a custom build with PuPHet puphpet.com you can just build your box however you like. Doesn't feel right using grunt commands from my virtual box its annoying how they relay on DB interaction.
    – Bobadevv
    Jun 9, 2016 at 9:03
2

Probably you run the grunt task from your local machine. In Magento 2 grunt is supposed to run server side.

Your Answer

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

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