WP-Cli not found in Vagrant SSH

I’m attempting to set up a local Trellis (v1.7.0) existing project that I’m collaborating with another developer on. Currently setting this project up on a new machine and starting fresh.

After cloning the repo I ran vagrant up from the trellis directory then composer install from site - both worked as intended. Next I attempted to import the database from vagrant ssh when running:

wp db import ******.sql

and get the following message:

$ wp 
-bash: wp: command not found

I have made sure WP-Cli is properly installed. Currently running WP-CLI version: 2.4.0

Further digging, I set up a new example.test Trellis project just to test and I was able to successfully run wp in the vagrant ssh without fail.

Any suggestions appreciated. Thanks

So wp is installed on your workstation? What does which wp say?
The wp executable may not be in the PATH of your shell, hence it can’t be found when invoking wp.

Thanks for the reply @strarsis

Yes, it’s install on my machine: WP-CLI version: 2.4.0

which wp: /usr/local/bin/wp

wp CLI tool must be installed on both, local and target system. Whaz does which wp print on the vagrant box itself?

If the repo you cloned from the other developer includes trellis, I’d check to make sure WP-CLI is being installed correctly. These files are the ones to check: https://github.com/roots/trellis/tree/master/roles/wp-cli

If that looks good, my next step would be to wipe out the current VM and reprovision.

Thanks for the reply. I checked and all files seems to be included. I removed the VM as suggested and received this error when provisioning:

non-zero return code
sudo: a password is required
fatal: [192.168.50.5]: FAILED! => {"changed": false, "rc": 1, "stderr_lines": ["sudo: a password is required"], "stdout": "", "stdout_lines": []}

I am having the exact same issue as mentioned by @matthew.hay in his original post above. And I get the same output including “-bash: wp: command not found”

I am running the wp db import from the /srv/www/example.com/current folder

It appears this wasn’t resolved and any help/guide will be appreciated.