Acorn installed but not working with Vagrant

I’m having issues running acorn and I unfortunately cannot find how to resolve it.

I’ve created a new project using trellis and have a Vagrant instance up and running and can log in fine. I can also ssh into the Vagrant machine.

I’ve installed acorn via composer from the /site directory with composer require roots/acorn, this resulted in a successful install with "roots/acorn": "^2.1"

However when I try to run wp acorn from OSX I get this error.

PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/xxx/xxx/xxx/site/web/wp/wp-includes/class-wpdb.php on line 1775
Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/xxx/xxx/xxx/site/web/wp/wp-includes/class-wpdb.php on line 1775
Error: `No such file or directory`
Error establishing a database connection
This either means that the username and password information in your `wp-config.php` file is incorrect or that contact with the database server at `localhost` could not be established. This could mean your host’s database server is down.

Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?

If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums. `No such file or directory`

I am installing GitHub - generoi/sage-woocommerce and it says to run a few acorn commands to set things up.

I’ve never been able to run wp commands directly from OSX but it seemed to be where I needed to run them from. When it didn’t work I tried to ssh into the Vagrant, cd to the current directory and run them from there. However, then I get the error below. wp user info works fine in the Vagrant though. It gives the same mysqli_real_connect when run from OSX.

Error: 'acorn' is not a registered wp command. See 'wp help' for available commands.
Did you mean 'core'?

I’m confused as to what I am doing wrong. Any assistance would be appreciated.

Thank you in advance.

Howdy! Ignore the Acorn piece for a second -

wp commands need to be ran either directly on the machine that is serving your WP site, or used with configured aliases (such as wp @development) to reach the intended machine.

This error means that Acorn hasn’t been booted. Do you have a Sage 10 theme activated already?

Hi @ben thanks for the quick reply!

I had forgotten about the wp aliases. I set that up and now at least wp @development acorn gives me the same error as within the vagrant.

As far as having a Sage 10 theme, I guess not. I was assuming somehow that the default theme in Trellis was a Sage 10 theme. I will install Sage 10 starter theme now.

1 Like

Once I installed the Sage10 starter theme and activated it, Acorn is now available. Thanks @ben!

1 Like