paliarush / magento2-vagrant-for-developers

Vagrant Box for Magento 2 Developers
MIT License
446 stars 165 forks source link

Problems with deep_merge #124

Closed nicolaspernot closed 7 years ago

nicolaspernot commented 7 years ago
  1. Clone repository :

git clone https://github.com/paliarush/magento2-vagrant-for-developers.git magento2-test

  1. Initializing :

cd magento2-test bash init_project.sh

  1. I get an error :

Message: NoMethodError: undefined method `deep_merge!' for #

I read somewhere deep_merge would be a vagrant plugin, but just a vagrant plugin install deep_merge return the same error.

paliarush commented 7 years ago

deep_merge is from ruby, and is used in Vagrantfile. Maybe there is a problem with your Vagrant version, what is it? What is your OS?

zharris-LTI commented 7 years ago

I also get this error.

Vagrant version: 1.9.0 OS: macOS Sierra 10.12.3

paliarush commented 7 years ago

I currently have vagrant 1.8.5 installed. Please try any Vagrant version lower than 1.9 and let me know if the problem goes away for you.

zharris-LTI commented 7 years ago

I downgraded to 1.8.7 but then I get an error when it attempts to install the vagrant-hostmanager plugin. This is the error:

Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:

An error occurred while installing ffi (1.9.17), and Bundler cannot continue. Make sure that gem install ffi -v '1.9.17' succeeds before bundling.

Warning: this Gemfile contains multiple primary sources. Using source more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run bundle config disable_multisource true.Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/opt/vagrant/embedded/bin/ruby -r ./siteconf20170217-8354-c9pwto.rb extconf.rb

checking for ffi.h... extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:587:intry_cpp' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:1060:in block in have_header' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:911:inblock in checking_for' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:351:in block (2 levels) in postpone' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:321:inopen' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:351:in block in postpone' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:321:inopen' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:347:in postpone' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:910:inchecking_for' from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:1059:in have_header' from extconf.rb:16:in

'

extconf failed, exit code 1

Gem files will remain installed in /Users/webslinga/.vagrant.d/gems/gems/ffi-1.9.17 for inspection. Results logged to /Users/webslinga/.vagrant.d/gems/extensions/x86_64-darwin-13/2.2.0/ffi-1.9.17/gem_make.out

nicolaspernot commented 7 years ago

deep_merge is from ruby, and is used in Vagrantfile. Maybe there is a problem with your Vagrant version, what is it? What is your OS?

Vagrant : 1.9

vagrant -v
Vagrant 1.9.0

Ubuntu 14.04

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

The issue comes from the init_project.sh when the script try to get the list of vagrant plugin :

vagrant_plugin_list="$(vagrant plugin list)"

I dug into it and deep_merge is a RoR method for merging Hash together. But my knowledge in Vagrant, Ruby language and RoR Framework are very low. I think I understand that Vagrant comes with its own Ruby environment, isolated from the host and hosted environment. If I check for the Ruby version in the VagrantFile :

puts RUBY_VERSION;

That print out the 2.2.5 Ruby version. That seems pretty cool. But I ignore how to get the Rails version neither from the code or the command line. I ignore too if, like Ruby, Rails comes natively with vagrant.

How can I dig it further ?

zharris-LTI commented 7 years ago

I haven't been able to make much progress on Vagrant 1.8.7 (or 1.85) due to the error I posted above. However, I noticed the change from config_data_dist.merge! to config_data_dist.deep_merge! in the Vagrantfile was made fairly recently (commit 078dd84). I changed it back to config_data_dist.merge! and that seems to have resolved the issue thus far.

nicolaspernot commented 7 years ago

I changed it back to config_data_dist.merge! and that seems to have resolved the issue thus far.

Maybe because merge() is ruby method and deep_merge() a RoR method. But the difference, I think, is that deep_merge() merge config files recursively. Merge is not design to do it. By the way, I'm not a Ruby developer, so it's a big I THINK :)

Maybe @paliarush can we implement a deep_merge() like method ? I'm not sure it's possible in the VagrantFile itself, but I see some examples through the web to do it. I think I can do this, but I need to know if I'm on the good way ?

paliarush commented 7 years ago

@nicolaspernot feel free to provide a pull request with your implementation of recursive merge. Looks like current deep_merge does not work well for everyone. Thank you

paliarush commented 7 years ago

@nicolaspernot did you have a chance to look into this issue?

aemdy commented 6 years ago

Encountering the same issue with macos 10.13 and Vagrant 2.1.2.

This trick helps though https://github.com/paliarush/magento2-vagrant-for-developers/issues/124#issuecomment-281372959

tomreece commented 6 years ago

Same issue here.

mac 10.13.4 Vagrant 2.1.2

refaelgold commented 6 years ago

same issue

mac 10.13.4 Vagrant 2.1.2