Rate this post
  • When use command line in magento 2, in file bin/magento with some code ex: setup, cache, indexer,…
  • Some time you can get error but nothing to debug.
  • Let try command follow:

php -d display_errors bin/magento >log.txt

Example: when I run sudo php bin/magento setup:upgrade, I get an error: “There are no commands defined in the “setup” namespace.”

Debug in command line mode
Debug in command line mode

 

  • So, I also get an warring: “Cannot read contents from file “/home/ubuntu/public_html/2.1.2.0/app/code/Dreamcode/Webapi/etc/module.xml” Warring: file_get_contents … : No such file or directory
  • And after then, I could find a solution to fix this problem and my command line working fine.
How to Fix No Tokens were Provided error When run Setup:di:compile in Magento 2
How to Loader Widget in Magento 2