首页 > 解决方案 > 在 `+' 中:没有将 nil 隐式转换为 String (TypeError)

问题描述

我正在安装 VVV 并在执行“vagrant up”命令时卡住了。它向我显示以下错误:

C:/Users/Admin/.vagrant.d/gems/2.6.6/gems/vagrant-hostsupdater-1.2.0/lib/vagrant-hostsupdater/HostsUpdater.rb:152:in `+': no implicit conversion of nil into String (TypeError)

当我打开 ruby​​ 文件时,

elsif Vagrant::Util::Platform.windows?
          require 'tmpdir'
          uuid = @machine.id || @machine.config.hostsupdater.id
          tmpPath = File.join(Dir.tmpdir, 'hosts-' + uuid + '.cmd')
          File.open(tmpPath, "w") do |tmpFile|
          entries.each { |line| tmpFile.puts(">>\"#{@@hosts_path}\" echo #{line}") }
          end
          sudo(tmpPath)
          File.delete(tmpPath)

“tmpPath = File.join(Dir.tmpdir, 'hosts-' + uuid + '.cmd')” 是给我错误的行。

我正在尝试通过 Youtube 视频安装 VVV,按照视频中给出的确切步骤进行操作,那么该视频为什么没有遇到此错误,而我却遇到了。

标签: rubyrubygemsvagrantvagrantfilevagrant-plugin

解决方案


推荐阅读