How to properly set up drush 9.7.0 on Windows 10 - drush

I am working on trying to set up and learn drush for the first time on a Drupal 8.7.3 site on Aqui DevDesktop which i installed with composer. This is the first time I have tired composer, and drush is completely new to me. (I was really impressed with the efficiency of composer with installing modules BTW... I am a complete noob to this stuff and it was rather easy)
To get drush I followed the directions provided at: https://docs.drush.org/en/master/install/ and ran:
composer require drush/drush
which gave me drush 9.7.0
I am able to get the command line to recognize drush status from any directory:
drush status
Drupal version : 8.7.3
Site URI : http://default
PHP binary : C:\xampp\php\php.exe
PHP config : C:\xampp\php\php.ini
PHP OS : WINNT
Drush script :C:\Users\user\Sites\devdesktop\drupalup_comp\vendor\drush\drush\drush
Drush version : 9.7.0
Drush temp : C:\Users\user\AppData\Local\Temp
Drush configs :
C:/Users/user/Sites/devdesktop/drupalup_comp/vendor/drush/drush/drush.yml
C:/Users/user/Sites/devdesktop/drupalup_comp/drush/drush.yml
Drupal root : C:\Users\user\Sites\devdesktop\drupalup_comp/web
Site path : sites/default
The trouble I am having is the command line doesn't want to recognize commands relative to the site itself. The documentations says that drush should be run from:
vendor/bin/drush
but there is no drush directory folder just the file and application within the bin directory. (maybe that's my problem?)
For example when i run:
C:\Users\user\Sites\devdesktop\drupalup_comp\vendor\bin> drush en migrate_tools
I get:
"Command pm:enable was not found. Drush was unable to query the database.
As a result, many commands are unavailable. Re-run your command with --
debug to see relevant log messages."
I have run the --debug, but was not smart enough to make heads or tails of it :). I am way over my head here, so I hope I have provided enough info for this to make sense. From the little bit I have gathered this could be a path issue? Any pointers would be much appreciated!
PS:
Composer installs modules like butter so quit crying about it and get with the times. If I can do it, you can too!!! :) :)

Config Your Settings.php
You have not a database, or run your mysql service
$databases['default']['default'] = array (
'database' => '',
'username' => '',
'password' => '',
'prefix' => '',
'host' => '',
'port' => '',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
And run Drush in your "Drupal root"
C:\Users\user\Sites\devdesktop\drupalup_comp/web
../vendor/bin/drush status

Related

Airflow on windows 10 - Module not found errors

I'm new to data science and wanted to do a little tutorial, which requires airflow, among other things. I installed it on windows using git bash in VS Code. I tried running it but it had a problem not being able to load the sqlite3 import
command (module not found error). I figured out that if I added the directory of sqlite3.py to the path, it would run, but now it gives me a similar error: pwd module not found from daemon.py
File "C:\ProgramData\Anaconda3\lib\site-packages\daemon\daemon.py", line 18, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'
Strange to me that it can't find pwd. Obviously pwd works in both git bash and powershell natively. It seems like a basic universal command. I'd love to learn more about what's going on. I don't want to have to end up adding 100 things to path just to get this program to run. I'd love any insights anyone can provide.
PS I'm using Anaconda.
it's seems to be the side effects of Spawning new Python Daemons .
You likely can fix this by downgrading the Python-Daemon :
pip install python-daemon==2.1.2

How to set up a TYPO3 site with docker and ddev?

I'm new to docker and I've been told ddev is a simple way to set up a local container to run a TYPO3 project.
But I'm confused. I'm not familiar with all these containers yet. How should I proceed to get a grip?
The tutorial is based on https://docs.typo3.org/m/typo3/guide-contributionworkflow/master/en-us/Appendix/SettingUpTypo3Ddev.html but mind – that is a step-by-step-manual if you want to contribute to the TYPO3 core. If you want to run your own site, the «Clone TYPO3» section doesn’t apply.
So start like this:
Install Docker (Desktop App is fine) from
https://www.docker.com/products/docker-desktop
Install ddev: https://ddev.readthedocs.io/en/latest/#installation (Mac: brew tap drud/ddev && brew install ddev)
Create a directory where you want to run the site: mkdir mysite; cd mysite
Configure ddev: run ddev config
There’s not much to choose from in the wizard. You can set the web-root (eg. public_html, so you have a level more above) and choose from a few CMS presets. They don’t change too much, in the case of TYPO3 it will manage the db connection and some nginx settings.
The file .ddev/config.yaml will be created. In it you can find a lot of options.
Add your site (and, if necessary, run composer)
Run ddev with ddev start
See if mkcert is installed, if not, follow the provided instructions (this will make sure you can use self-signed certificates, at least in firefox) (mac: brew install mkcert nss; mkcert -install)
ddev will output a few informations, where you can find your site, which port, where phpmyadmin is etc
ddev help gives you more commands
If you want to log into the container, use ddev ssh. This is NOT used to change files etc. The files are mirrored automatically into the container! But you can log in to install binaries etc. Let’s try that.
Some commands you may need: What system are we running? uname -a -> linuxkit // Update available packages: sudo apt-get update // Search for a package apt-cache search packagename // Install Pdftools (pdftotext, pdfinfo..): sudo apt-get install poppler-utils // Get the path to imagemagick (if it’s already installed): whereis convert (remember, imagemagick is a collection, convert is one of the tools) // log out from the container, back to your system: exit
Now, how to connect to the database which lives inside the docker container?
run ddev describe and you will get the login data. It’s basically db for everything.
For TYPO3, the ddev setup command provides an AdditionalConfiguration.php file that can be used. It’s missing two important parameters though, SystemMaintainers and Installtool Password. Here’s an example.
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'], [
'dbname' => 'db',
'host' => 'db',
'password' => 'db',
'port' => '3306',
'user' => 'db',
]);
// This mail configuration sends all emails to mailhog
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'smtp';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server'] = 'localhost:1025';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
// add these
$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemMaintainers'] = [123,456];
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = 1; // optional
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '123';
But what if you want to access the database with a separate tool instead of the preconfigured phpMyAdmin? If you use sequel pro, simply run ddev sequelpro and your database will be launched automagically in sequel pro.
You can also do this manually; then you need to define the db port to access it externally. Do this in .ddev/config.yaml, by adding (for example) host_db_port: "32778" Now we can set up a db management tool as such (and store the bookmark):
Remember: PHP will still use the default Port 3306!
Ok, here we go. ddev is already started, so make sure you’re in your local directory (where .ddev/ is) and run ddev describe to see the parameters again. Probably, if you go to https://mysite.ddev.local, you will find everything from your webroot working.
When done, finish with ddev stop. I’m not really sure where databases are persisted though yet, when ddev is stopped. Maybe you get a dump first with ddev snapshot.
Explore many more possibilities of ddev with ddev help.

Getting Rsync 3.0.9 to work on Vagrant VM box through Cygwin on windows 7

My vagrant VM box is super slow when I try to run my Rails app on it, and I'm guessing it's due to the shared folder problem.
I am trying to use rsync to circumvent the problem.
I installed Cygwin and necessary packages, put C:\cygwin64\bin; as PATH environment variable
and then changed my Vagrantfile to
config.vm.synced_folder ".", "/vagrant", type: "rsync"
When I run vagrant up, I Get this error message
$ vagrant up Bringing machine 'default' up with 'virtualbox'
provider... "rsync" could not be found on your PATH. Make sure that
rsync is properly installed on your system and available on the PATH.
What's going wrong here?
Thank you so much ... if there's any other way to run Vagrant VM box smoothly and faster on Windows 7, I would love to hear it too.
This turned out to be a bunch of brick-walls you have to circumvent when installing Rsync and setting it up correctly for Vagrant on Windows 7.
First of all, the error "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH. was due to the fact that
1) Environment variable for Cygwin was placed in the latest order in the PATH, I changed it to the beginning of the path
2) During installation of Cygwin and Rsync, I installed individual "subpackages" instead of installing everything, thinking that it would be okay. Turns out I was wrong. I installed everything in the Admin package and Net package (not the SRC but just the bins), and then it started working. I suggest you set-up Cygwin again and really try to download everything if you see that error.
(I found these solutions through this post on SO cygwin + rsync)
Now, I could go into CMD and type rsync, and it would show up correctly. But then when I ran vagrant up it gave me another error saying
There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.
Host path: /c/Users/xxxxx Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links
--chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyCh
/c/Users/xxxx / vagrant#127.0.0.1:/vagrant
Error: cygwin warning: MS-DOS style path detected:
C:/Users/xxxxxxx Preferred POSIX
equivalent is:
/cygdrive/c/Users/xxxx CYGWIN
environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of
known hosts. rsync: change_dir "/c/Users/xxxxxxx"
failed: No such file or directory (2) rsync error: some files/attrs
were not transferred (see previous errors) (code 23) at
/usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052)
[sender=3.0.9]
I googled solution to this error and found this site. https://github.com/mitchellh/vagrant/issues/3230
Then there's a bug with Vagrant and cwrsync that I mentioned in #3086.
For now, just edit
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb
and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible
solution but quick and simple.
Editing that helper.rb file and adding hostpath at line 74 (just made some blank lines right there and pasted it in) and now it works perfectly!!!!
Rsync makes the shared folder soooooo much faster on Rails!!!! I think it is worth the pain of setting it up correctly. Try it!!
It's not clear from your message, but I think you installed rsync on your machine (the host), while it needs to be installed on the virtual machine you bringing up (the guest).

Node.js not found by Rails / execjs

I have node.js installed by compiling and installing it from the root user. I think this maybe where the hangup is. From the user running the rails app I checked for node.js.
$ which node
/usr/local/bin/node
When I launched my rails app (Rails 3.2.9) I get the universally unhelpful "We're sorry, but something went wrong." Checking the the production error log I saw that the Javascript runtime was not found. That's confusing as it is obviously installed. So I went about forcing the Node javascript runtime. I edited config/boot.rb to include:
ENV['EXECJS_RUNTIME'] = 'Node'
I checked my app again, while watching the production log. This time I got the error
ActionView::Template::Error (Node.js (V8) runtime is not available on this system
Still confused. I went to the execjs gem and changed the runtime command to the exact installed path.
Node = ExternalRuntime.new(
:name => "Node.js (V8)",
:command => "/usr/local/bin/node",
:runner_path => ExecJS.root + "/support/node_runner.js",
:encoding => 'UTF-8'
)
I still get the same error. Node is installed and accessible by the user but the gem/rails can't seem to use it.
The server is run CentOS 6.3. The specific javascript file causing the error to be thrown is jquery.nivo.slider.pack.js. Which I didn't edit after downloading it from nivo.
So, I have Ruby 2.0.0 installed and Rails 4.0.2 on CentOS 5.10 using Apache2 with Passenger. My first step I tried was opening the rails console and typing in the following command:
ExecJS.runtime
It returned the following value:
#<ExecJS::ExternalRuntime:0x99ab380 #name="Node.js (V8)", #command=["nodejs", "node"],#runner_path="/home/foo/vendor/bundle/ruby/2.0.0/gems/execjs-2.1.0
/lib/execjs/support/node_runner.js", #encoding="UTF-8", #deprecated=false, #binary="node">
Which meant that node was indeed installed and detected, but for some reason it was not working.
So, I tried the example on the website:
ExecJS.eval("'red yellow blue'.split(' ')")
and I got the correct response. So, now I am wondering why Passenger isn't picking it up.
Then, I noticed that passenger shows the path variable and it looks like:
/home/foo/vendor/bundle/ruby/2.0.0/bin:/usr/local/rvm/gems/ruby-2.0.0-p481/bin:/usr/local/rvm/gems/ruby-2.0.0-p481#global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p481/bin:/usr/kerberos/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/rvm/bin:/home/foo/bin
But, it seems to be missing the usr/local/bin. I'm no expert on Linux, so for me the easiest way to fix this is with a symbolic link. So, I execute ln -s /usr/local/bin/node /usr/bin/node. You may want to note that I found the path to my nodejs using the command find / -name node.
I then refreshed my web application and wouldn't you know it worked. So, if it worked for me I am hoping that it can help someone else out.
UPDATE (Probably Better Way): This is probably a better way to do it. We can compile it from source like so:
mkdir ~/install
cd ~/install
wget https://nodejs.org/dist/v7.2.1/node-v7.2.1.tar.gz
tar xvf node-v7.2.1.tar.gz
cd node-v7.2.1
./configure --prefix=/usr/
make && make install
This way Node.js will be installed in the path where Passenger expects it to be.
I have had similar issue installing nodejs with source on my centos 6.3 system. It was successfully installed but I keep failing in compiling my ror app assets until I explicitly set the PATH to where it was installed (nodejs)
[root]# make install
...
installing /usr/local/lib/node_modules/npm/html/doc/folders.html
symlinking ../lib/node_modules/npm/bin/npm-cli.js -> /usr/local/bin/npm
updating shebang of /usr/local/bin/npm to /usr/local/bin/node
[root]# export PATH=/usr/local/bin:$PATH
Now it works. Hope that helps!
I don't know if this will help but check your $PATH that node is in there. Also, you should be using rvm if you want to use node. Check that your node install is done correctly.

Erlang install: "Can't find config file " error message

I'm trying to install Yaws on my Ubuntu 11.01 system via apt-get install yaws. But when I call the shell script yaws from the command line I get the following error: Yaws: Bad conf: "Can't find config file "
Unless my aging eyes are missing something, I can't find enlightenment in either the Yaws website or Zachery Kessin's book.
I can find configuration files in /etc/yaws. But is there something else I need to know/do?
Thanks,
LRP
If you installed yaws with the package manager then it's controlled by an init script (and you should work with that instead of running yaws manually, I'll add).
You're most likely running yaws as a non-privileged user, and if you look closely, the directory /etc/yaws is:
drwxr-x--- 4 root yaws 4096 Aug 7 10:36 yaws
You're probably trying to run yaws under a user other than root, and without membership in the yaws group.
I would venture a guess that this is a bug in the distro's packaging rather than in yaws since the man page clearly states that running it as a non-privileged user it falls back to reading /etc/yaws/yaws.conf, except that under Debian/Ubuntu (I'm on Debian 6) the permissions on /etc/yaws/ do not live up to the claim in the map page.
But, if you work through the distro's init script and daemon management facilities your problem goes away magically. That I think is preferable to tapping the Debian packager on the shoulder and having a long conversation about config directory permissions. :)
Try doing the following.
$ touch yaws.conf
$ yaws
Hit the enter key to bring up the prompt. Works on Debian 7 (wheezy).
You may also want to do the following to place your username in the yaws group.
$ adduser USERNAME yaws
To one of the maintainers of this package found in the readme file, I have pointed them to here.
$ dpkg -L yaws | grep -i readme
My system is Debian 7 or often called wheezy distro. It's actually kali-linux but that's just fyi stuff. I browsed to /etc/yaws as root with nautilus otherwise it's locked.
~$ sudo su
[sudo] password for username:
# nautilus
Initializing nautilus-gdu extension
Now you may look in the /etc/yaws directory.
The yaws.conf should be in there. Josef would be correct as this is what yaws will try to use if the user has access to this file. But not being root you don't.
My solution is to just get ideas out of that file and the others within the same directory. Take this next answer from Van and make your home/user have a yaws.conf and play around with different configurations from what you found in the etc one. Not that hard to copy and paste if you just have access to the files. Enjoy! :-D

Resources