0

Should I globally install Drush and use it locally, or should I use install and use it locally?

I globally installed it with Composer, then added C:\Users\Md. Shafiq Hossain\AppData\Roaming\Composer\vendor\drush\drush to the PATH variable.

When I change the current directory C:\My Work2\src\Drupal\clientname\projectname and type drush version, it gives me the following error.

'C:/Users/Md.' is not recognized as an internal or external command, operable program or batch file

I tried with the project wise. I installed correctly, but drush version returns the following error.

Drush is not recognize as internal or external command

If anyone can help me on this will be great.

  • Have you tried running drush from your vender bin directory? – Jay Chand Mar 2 '18 at 16:01
  • Yes. And globally its working. When changed to local directory getting error message due to spaces in the path of drush – Md. Shafiq Hossain Mar 2 '18 at 17:48
2

The Drush 9 documentation is pretty clear: Install Drush locally, in your Drupal site, using composer. You can install Drush Launcher in addition if you want it more convenient.

Without Drush Launcher, you can use the site local Drush be running

vendor\bin\drush some-drush-option

from your Drupal site root. No need to modify any paths.

If you install the Drush launcher (and use Windows), create a suitable bat file.

NB! Adding C:\Users\Md. Shafiq Hossain\AppData\Roaming\Composer\vendor\drush\drush to the path is plain wrong. If you really want to modify the path (to get the convenience of using just drush without installing Drush Launcher), the correct path is [...]\vendor\bin.

  • where is the vendor folder located? – DavSev Apr 8 '18 at 11:30
  • @DavSev it depends how you have set up your Drupal install. For example, if you are using drupal-composer/drupal-project then by default it installs it in the root of your composer project, which is one directory up from your Drupal web root. You can however configure that differently or if you used a different install method it might be different. – rooby Apr 9 at 2:04

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.