While Local’s “Open Site Shell” allows running WP-CLI commands, is there a way to use them seamlessly within VS Code’s integrated terminal for a smoother workflow?
I get the error below when i try
wp acorn make:component test) in vscode :
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\Subcommand::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
Error: Error establishing a database connection.
This works for me inside VS Code’s terminal, so I don’t think the issues are specific to VS Code. But there are a couple of things going on in your output:
It looks like that deprecation notice may be related to your WP-CLI and PHP versions. Try
wp cli update and see if that helps there. I think 2.9.0 is the latest.
As far as the database connection error, that’s because wp-cli isn’t able to access your database with the db config values found in
wp-config.php. I don’t have specific experience with Local, but you could try changing
127.0.0.1. I have seen that fix wp-cli db connections in the past.
I’ll give it a try