ruby-on-rails - 通过 Windows 7 上的 Cygwin 让 Rsync 3.0.9 在 Vagrant VM box 上工作

标签 ruby-on-rails windows cygwin vagrant rsync

当我尝试在其上运行我的 Rails 应用程序时,我的 vagrant VM box super 慢,我猜这是由于共享文件夹问题。

我正在尝试使用 rsync 来规避这个问题。 我安装了Cygwin和必要的包,把C:\cygwin64\bin;作为 PATH 环境变量 然后将我的 Vagrantfile 更改为 config.vm.synced_folder ".", "/vagrant", 输入: "rsync"

当我运行 vagrant up 时,我得到这个错误信息

$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH.

这里出了什么问题? 非常感谢...如果有任何其他方法可以在 Windows 7 上更流畅、更快地运行 Vagrant VM box,我也很想听听。

最佳答案

在 Windows 7 上安装 Rsync 并为 Vagrant 正确设置它时,这是一堆砖墙,你必须绕过它。

首先,在您的 PATH 中找不到错误 “rsync”。确保 rsync 已正确安装在您的系统上并且在 PATH 上可用。 是因为

1)Cygwin的环境变量放在PATH中最新的顺序,我改成路径开头

2) 在安装Cygwin和Rsync的过程中,我安装了单独的“子包”,而不是安装所有的东西,以为这样就可以了。结果我错了。我在 Admin 包和 Net 包中安装了所有东西(不是 SRC,而是 bins),然后它开始工作了。我建议您重新设置 Cygwin,如果您看到该错误,请真正尝试下载所有内容。 (我通过 SO cygwin + rsync 上的这篇文章找到了这些解决方案)

现在,我可以进入 CMD 并输入 rsync,它会正确显示。但是当我运行 vagrant up 时,它给了我另一个错误提示

There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.

Host path: /c/Users/xxxxx Guest path: /vagrant Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyCh /c/Users/xxxx / vagrant@127.0.0.1:/vagrant Error: cygwin warning: MS-DOS style path detected: C:/Users/xxxxxxx Preferred POSIX equivalent is: /cygdrive/c/Users/xxxx CYGWIN environment variable option "nodosfilewarning" turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. rsync: change_dir "/c/Users/xxxxxxx" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052) [sender=3.0.9]

我用谷歌搜索了这个错误的解决方案并找到了这个网站。 https://github.com/mitchellh/vagrant/issues/3230

Then there's a bug with Vagrant and cwrsync that I mentioned in #3086. For now, just edit C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible solution but quick and simple.

编辑 helper.rb 文件并在第 74 行添加主机路径(只是在那里制作了一些空白行并将其粘贴进去)现在它完美运行了!!!!

Rsync 使共享文件夹在 Rails 上变得更快!!!!我认为正确设置它是值得的。试试吧!

关于ruby-on-rails - 通过 Windows 7 上的 Cygwin 让 Rsync 3.0.9 在 Vagrant VM box 上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24127799/

相关文章:

c++ - 如何拦截 "Show Desktop"事件?

python - 成功进行 SSH key 身份验证后,SSH 和 SCP 命令无法执行,并显示错误消息 : Win32 error 1114

c++ - CLion with Cygwin : g++. exe .../compiler-arguments.txt: No such file or directory 错误

ruby-on-rails - 文章中的 ActionController::UrlGenerationError#edit

ruby-on-rails - 处理版本时如何跳过载波存储回调

javascript - 在 Rails 中异步加载 Div

javascript - 将 JSON 中的大数字解析为字符串

windows - 我想创建一个批处理脚本,它将按修改日期的顺序打印文件夹中的所有文件

java - 如何在 Windows 上从 Java 生成 bash 脚本?

css - Rails Assets 管道 : fonts not found