geerlingguy / drupal-vm

A VM for Drupal development
https://www.drupalvm.com/
MIT License
1.37k stars 647 forks source link

Vagrant failed to initialize at a very early stage: There was an error loading a Vagrantfile. The file being loaded and the error message are shown below. #2171

Closed chunesh closed 2 years ago

chunesh commented 3 years ago

Issue Type

Your Environment

vagrant --version: Vagrant 2.2.10
vboxmanage --version: 6.1.16r140961
ansible --version: ansible [core 2.11.0] 

Your OS

Full console output

vagrant up --provision Vagrant failed to initialize at a very early stage:

There was an error loading a Vagrantfile. The file being loaded and the error message are shown below. This is usually caused by a syntax error.

Path: /drupal/Vagrantfile Line number: 0 Message: ArgumentError: Malformed version number string [core

Summary

vagrant up --provision is failing and throwing the above error.

Vagrantfile content: `

The absolute path to the root directory of the project. Both Drupal VM and the config file need to be contained within this path.

ENV['DRUPALVM_PROJECT_ROOT'] = "#{dir}"

The relative path from the project root to the config directory where you placed your config.yml file.

ENV['DRUPALVM_CONFIG_DIR'] = "box"

The relative path from the project root to the directory where Drupal VM is located.

ENV['DRUPALVM_DIR'] = "vendor/geerlingguy/drupal-vm"

Load the real Vagrantfile

load "#{dir}/#{ENV['DRUPALVM_DIR']}/Vagrantfile" `

phizev commented 3 years ago

This is a duplicate of #2166, and has been fixed in the latest release of DrupalVM (6.0.4 at time of writing).

chunesh commented 3 years ago

Thanks,

I have updated my Drupal VM from 5.0 to 6.0.4 and the vagrant up --provision is working.

I am upgrading the PHP version from 7.3 to 7.4 and now vagrant up --provision is failing and throwing the below error

TASK [geerlingguy.php : Ensure PHP packages are installed.] **** fatal: [drupalvm]: FAILED! => {"changed": false, "msg": "No package matching 'php7.4' is available"}

PLAY RECAP ***** drupalvm : ok=73 changed=19 unreachable=0 failed=1 skipped=69 rescued=0 ignored=0

Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again.

crasx commented 3 years ago

@chunesh if you are changing php versions you should run vagrant destroy before vagrant up. Note this will delete all your data. The changing of PHP versions can be pretty complicated so its usually easier to start from scratch in that case

gabe-connolly commented 3 years ago

For anyone else that comes here with the error below:

TASK [geerlingguy.php : Ensure PHP packages are installed.] ********************
fatal: [drupalvm]: FAILED! => {"changed": false, "msg": "No package matching 'php7.4' is available"}

I was having the same issue re-provisioning my local VM to use php7.4, and even trying to re-prevision after a vagrant destroy just using php7.3. Some digging revealed that this was due to the dropping of support for Ubuntu 16.04:

https://www.patreon.com/posts/ubuntu-16-04-lts-52120358

To resolve this I had to make the following adjustments in my box/config.yml file:

# Old version
vagrant_box: geerlingguy/ubuntu1604
php_version: "7.3"
php_xdebug_version: 2.7.0
# After changes
vagrant_box: geerlingguy/ubuntu1804
php_version: "7.4"
php_xdebug_version: 3.0.4

Depending on what additional extras you have installed you may need to bump some additional versions on those extras to be compatible with php7.4, but based on the experience I had the errors presented in provisioning give good enough bread crumbs to identify those relatively easily.

stale[bot] commented 2 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 2 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

pundhir1111 commented 2 years ago

D:\Workpractice\kubernetes\cluster>vagrant up Vagrant failed to initialize at a very early stage:

The executable 'cmd.exe' Vagrant is trying to run was not found in the %PATH% variable. This is an error. Please verify this software is installed and on the path.

pundhir1111 commented 2 years ago

facing this error, please help to resolve this issue. using win 11.