6

Magento 2

After running: grunt clean and then grunt exec:myTheme I get the following

error: >> [InvalidArgumentException]

There are no commands defined in the "dev:source-theme" namespace.
Exited with code: 1.

Warning: Task "exec:myTheme" failed. Use --force to continue.

Anyone know what this could relate to?

9

I have the same issue and I solved it by removing the 2 folders below :

  • /var/di
  • /var/generation
| improve this answer | |
  • You don't necessarily need to remove these directories. Just set 777 permission to var folder. Should work fine. – Sourabh Modi Jun 9 '16 at 9:23
  • php bin/magento setup:static-content:deploy and then clearing all caches made it work for me – dlicheva Dec 6 '16 at 14:39
0

I had this issue. It arose after I installed a Magento Theme into a subfolder of the root directory of my virtual host (i.e. /Applications/MAMP/htdocs/magento2/mycustomtheme_magento2_quickstart). I then proceeded to run grunt clean followed by grunt exec:mycustomtheme within the theme sub-directory, and got the error There are no commands defined in the "dev:source-theme" namespace..

I tried removing the /var/generation sub-folder but this did not solve the problem (I did not have a /var/di sub-folder).

I eventually solved it by simply opened my web browser (i.e. Chrome) and went to the subfolder address of my custom theme using my virtual host (i.e. http://local.magento2:8888/mycustomtheme_magento2_quickstart/).

It opened the Magento Installer page. I went through the steps to set it up (i.e. Step 1: Readiness Check, etc).

After it was setup I was able to run grunt clean followed by grunt exec:mycustomtheme without that error.

| improve this answer | |
0

grunt:exec command relies on php bin/magento dev:source-theme:deploy

if the command would not success There are no commands defined in the "dev:source-theme" namespace can appear as well.

In my case, after playing with local environment bit too much I've had to replace default php version in CLI from 5.6 to 7.0 for Magento 2.2.

| improve this answer | |

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.