Wednesday, March 20, 2019

[success] No site aliases found. drush 9

[success] No site aliases found. drush 9

Running drush sa returns below message in drush 9?

[success] No site aliases found.

Here is the solution:
NOTE: Tested with drush installed globally

Run drush debug command:
drush st --debug -vvv
 Sample output from above:

 [preflight] Config paths: /home/sastha/.composer/vendor/drush/drush/drush.yml
 [preflight] Alias paths:
 [preflight] Commandfile search paths: /home/sastha/.composer/vendor/drush/drush/src
 [bootstrap] Starting bootstrap to max [0.3 sec, 7.64 MB]
 [debug] Trying to bootstrap as far as we can [0.3 sec, 7.64 MB]
 PHP binary    : /usr/bin/php7.2
 PHP config    : /etc/php/7.2/cli/php.ini
 PHP OS        : Linux
 Drush script  : /home/sastha/.composer/vendor/drush/drush/drush
 Drush version : 9.6.0
 Drush temp    : /tmp
 Drush configs : /home/sastha/.composer/vendor/drush/drush/drush.yml


Alias Path is missing as highlighted above


Sample drush.yml content:
sastha@DESKTOP $ cat /home/sastha/.composer/vendor/drush/drush/drush.yml
#This is a Drush config file. Sites may override this config to change minimum PHP.
drush:
  php:
    minimum-version: 5.6.0
  paths:
    alias-path:
     - /home/sastha/sites

Check if alias-path is set?

sastha@DESKTOP $ drush st --debug -vvv
 [preflight] Config paths: /home/sastha/.composer/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/sastha/sites
 [preflight] Commandfile search paths: /home/sastha/.composer/vendor/drush/drush/src
 [bootstrap] Starting bootstrap to max [1.47 sec, 7.64 MB]
 [debug] Trying to bootstrap as far as we can [1.48 sec, 7.65 MB]
 PHP binary    : /usr/bin/php7.2
 PHP config    : /etc/php/7.2/cli/php.ini
 PHP OS        : Linux
 Drush script  : /home/sastha/.composer/vendor/drush/drush/drush
 Drush version : 9.6.0
 Drush temp    : /tmp
 Drush configs : /home/sastha/.composer/vendor/drush/drush/drush.yml

Problem solved!

Yes formatting is bad because no one is reading my blog except me :) :) :)

Friday, March 1, 2019

Drupal 8 Composer failure on Windows 7 with the message "bin\phpcs" "--config-show" "installed_paths"" failed.

Drupal 8 Composer failure with the below message on Windows 7:

 ""D:\www\mydrupalsite/vendor/bin\phpcs" "--config-show" "installed_paths"" failed.

Solution: 

Save this as phpcs.bat inside D:\www\vendor\bin:

@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../squizlabs/php_codesniffer/bin/phpcs
php "%BIN_TARGET%" %*

Monday, February 4, 2019

DrupalcampNJ: YouTube Channel

Drupal 8: Using Kint to print views fields

How to print fields variable of a views?

{{ kint(fields) }}

To resolve Out of memory issue:
https://www.drupal.org/project/devel/issues/2764023

Edit modules/devel/kint/kint/config.default.php and set $_kintSettings['maxLevels'] to a lower number (the default is 7)

My recommendation: Set it to 4 if you are using Windows


PHP error while enabling Drupal 8 Devel Module

Error Message:
The website encountered an unexpected error. Please try again later.Symfony\Component\Routing\Exception\RouteNotFoundException: Route "devel.execute_php" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 202 of core\lib\Drupal\Core\Routing\RouteProvider.php).

Reason:
Most probably you are installing Devel module (8.x-2.0) with Admin Toolbar installed

Fix:
https://www.drupal.org/project/admin_toolbar/issues/3009193
Upgrade to latest version of Admin Toolbar (8.x-1.26)