Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 847 forks source link

Error with tools provisioner when installing WP CLI #2600

Closed unfulvio closed 2 years ago

unfulvio commented 2 years ago

I have updated develop branch to use 3.9.1 recently (can't remember earlier version but it wasn't much older).

I wanted to reprovision my sites after that, but I stumbled into an error and now I'm stuck with all sites not working due not being correctly provisioned.

What was The Command Used To Provision

vagrant up --provision

or

vagrant reload --provision

What Kind of VVV Provision Was This

Logs/What Broke

While running the commands above the provisioner always halts with this error:

    default:  * [WP-CLI]: Updating packages
    default: Error: Failed to update packages (Composer return code 2).
! The 'tools' provisioner ran into problems, the full log is available at '/var/log/provisioners/2022.04.20_06-30-03/provisioner-tools.log'. It completed in 8 seconds.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

The logs would then contain the following:

Problem 1
    - Root composer.json requires wp-cli/doctor-command dev-master, it is found wp-cli/doctor-command[dev-master] in the lock file and wp-cli/doctor-command[dev-fix/adapt-branch-alias, dev-main, v0.1.0, v2.0.0, v2.1.0] from vcs repo (github git@github.com:wp-cli/doctor-command.git) but these do not match your constraint and are therefore not installable. Make sure you either fix the constraint or avoid updating this package to keep the one from the lock file.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
---
Error: Failed to update packages (Composer return code 2).
 ! The 'tools' provisioner ran into problems, the full log is available at '/var/log/provisioners/2022.04.20_06-30-03/provisioner-tools.log'. It completed in 8 seconds.

The following is my config yml (note that I have tried disabling customfile will not change outcome - I was using customfile before to allow NFS shares and nothing else).

---
sites:

  skyverge:
    skip_provisioning: false
    description: "SkyVerge Plugin Development"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    allow_customfile: true
    nginx_upstream: php80
    hosts:
      - skyverge.test
    custom:
      delete_default_plugins: true
      install_plugins:
        - bbpress
        - buddypress
        - code-snippets
        - query-monitor
        - wp-crontrol
      wpconfig_constants:
        WP_DEBUG: true
        WP_DEBUG_LOG: true
        WP_DEBUG_DISPLAY: true
        WP_DISABLE_FATAL_ERROR_HANDLER: true

  woocommerce:
    skip_provisioning: false
    description: "WooCommerce Core Development"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    allow_customfile: true
    nginx_upstream: php80
    hosts:
      - wc.test
    custom:
      delete_default_plugins: true
      install_plugins:
        - code-snippets
        - query-monitor
        - wp-crontrol
      wpconfig_constants:
        WP_DEBUG: true
        WP_DEBUG_LOG: true
        WP_DEBUG_DISPLAY: true
        WP_DISABLE_FATAL_ERROR_HANDLER: true

# Utilities https://varyingvagrantvagrants.org/docs/en-US/utilities/
utilities:
  core: # The core VVV utility
    - tls-ca # HTTPS SSL/TLS certificates
    - phpmyadmin # Web based database client
    #- memcached-admin # Object cache management
    #- opcache-status # opcache management
    #- webgrind # PHP Debugging
    #- mongodb # needed for Tideways/XHGui
    #- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/
    #- nvm # Node Version Manager
    - php
    #- php56
    #- php70
    #- php71
    #- php72
    #- php73
    #- php74
    #- php80
    #- php81

utility-sources:
  core:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-utilities.git
    branch: master

vm_config:
  memory: 8096
  cores: 2

general:
  # Back up Options
  # You can always backup/restore manually using vagrant ssh -c "db_backup" or vagrant ssh -c "db_restore"
  # Backup the databases to the database/backups subfolder on halt/suspend/destroy, set to false to disable
  db_backup: true
  # Import the databases if they're missing from backups
  db_restore: false
  # set to true to use a synced shared folder for MariaDB database storage
  db_share_type: false
  # GitHub token to use from composer
  #github_token: xxxxxx

# Settings for the vagrant plugins supported by VVV
vagrant-plugins:
  disksize: 10GB # requires the disk size vagrant plugin

Provisioning will fail also if I set to skip provisioning for all these sites (basically I provision with just vvv.test and tools).

unfulvio commented 2 years ago

just now I tried to use - wpcli-dev in the tools config but that didn't change the error thrown

unfulvio commented 2 years ago

tried to update VirtualBox (was on 6.1.3x, moved to 6.1.32) and restarted machine, no difference

tomjn commented 2 years ago

VirtualBox and vagrant will only impact this if the VM isn't starting, but your VM has started, this is a provisioning problem

tomjn commented 2 years ago

That extension won't help here as that adds a new WP CLI dev environment, the general gist is that the WP CLI doctor package should be removed as you're having trouble updating it. We no longer install this package due to the various issues we had with it.

If you vagrant ssh then use the wp package command you can see the packages listed and remove the doctor package:

https://developer.wordpress.org/cli/commands/package/

WordPress Developer Resources
wp package | WP-CLI Command | WordPress Developer Resources
WP-CLI packages are community-maintained projects built on WP-CLI. They can contain WP-CLI commands, but they can also just extend WP-CLI in…
tomjn commented 2 years ago

most likely wp package uninstall wp-cli/doctor-command

unfulvio commented 2 years ago

that did it! thank you!

do you think it's worth mentioning in the docs? I'd be happy to open a PR to https://github.com/Varying-Vagrant-Vagrants/varyingvagrantvagrants.org for you if it is common enough - I don't think I saw a corresponding section in Troubleshooting

GitHub
GitHub - Varying-Vagrant-Vagrants/varyingvagrantvagrants.org: The VVV docs and website
The VVV docs and website. Contribute to Varying-Vagrant-Vagrants/varyingvagrantvagrants.org development by creating an account on GitHub.
tomjn commented 2 years ago

That's a good idea, a PR would be great :)

unfulvio commented 2 years ago

here: https://github.com/Varying-Vagrant-Vagrants/varyingvagrantvagrants.org/pull/208