Vagrant - paver devstack error: "[Errno 20] Not a directory"

Vagrant - paver devstack error: "[Errno 20] Not a directory"

我正在尝试通过 Vagrant 安装 edx Devstack,我在 Windows 机器上。我收到的错误似乎是由 Windows 不支持的 symlinks 引起的。

根据 Dealing with line endings and symlinks under Windows 下的 edx 故障排除指南,我应该 运行 在 cygwin 中使用以下命令来处理 symlinks。

git rm --cached -r . && git reset --hard

git config --global alias.add-symlink '!__git_add_symlink(){
    dst=$(echo "")/../$(echo ""); 
    if [ -e "$dst" ]; then 
        hash=$(echo "" | git hash-object -w --stdin); 
        git update-index --add --cacheinfo 120000 "$hash" ""; 
        git checkout -- ""; 
    else 
        echo "ERROR: Target $dst does not exist!"; 
        echo "       Not creating invalid symlink."; 
    fi; 
    }; __git_add_symlink "" ""'

git config --global alias.rm-symlink '!__git_rm_symlink(){
    git checkout -- ""; link=$(echo ""); 
    POS=$'\''/'\''; DOS=$'\''\\'\''; 
    doslink=${link//$POS/$DOS}; 
    dest=$(dirname "$link")/$(cat "$link"); 
    dosdest=${dest//$POS/$DOS}; 
    if [ -f "$dest" ]; then 
        rm -f "$link"; 
        cmd //C mklink //H "$doslink" "$dosdest"; 
    elif [ -d "$dest" ]; then 
        rm -f "$link"; 
        cmd //C mklink //J "$doslink" "$dosdest"; 
    else 
        echo "ERROR: Something went wrong when processing  . . ."; 
        echo "       $dest may not actually exist as a valid target."; 
    fi; 
    }; __git_rm_symlink ""'

git config --global alias.rm-symlinks '!__git_rm_symlinks(){
    for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; 
    do 
        git rm-symlink "$symlink"; 
        git update-index --assume-unchanged "$symlink"; 
    done; 
    }; __git_rm_symlinks'

git config --global alias.checkout-symlinks '!__git_checkout_symlinks(){
    POS=$'\''/'\''; DOS=$'\''\\'\''; 
    for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; 
    do 
        git update-index --no-assume-unchanged "$symlink"; 
        if [ -d "$symlink" ]; then 
            dossymlink=${symlink//$POS/$DOS}; 
            cmd //C rmdir //S //Q "$dossymlink"; 
        fi; 
        git  checkout -- "$symlink"; 
        echo "Restored git symlink $symlink <<===>> `cat $symlink`"; 
    done; 
    }; __git_checkout_symlinks'

git rm-symlinks

我也尝试了 Git symlinks in Windows 的 SO 答案中的命令,结果相同。

输出:

我在 运行 执行上述命令后得到的输出有点奇怪,所以我不确定脚本是否成功。

User@Computer /cygdrive/c/.../Local/devstack/edx-platform/edx-platform $./symlinks-fix.sh
**Git checkout output**
...
Checking out files: 100% (6983/6983), done.
HEAD is now at 222bdd9 Merge pull request #10411 from edx/mobile/course-blocks-api

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\...\Local\devstack\edx-platform\edx-platform>

为什么最后会进入Windows风格的命令提示符?这是我不确定 git 命令是否有效的地方。

在 Vagrant 中:

在 运行ning vagrant upvagrant ssh 之后,当 运行ning paver devstack lms 时出现以下错误(paver devstack studio 的类似输出):

vagrant@precise64:~$ sudo su edxapp
edxapp@precise64:~/edx-platform$ paver devstack lms
...
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/github.txt
  Could not find a tag or branch '96e1922348bfe6d99201b9512a9ed946c87b7e0b', assuming commit.
  .... 20 similar ....
  Could not find a tag or branch 'e7a6c95c300e95c51e42bfd1eba70489c05a6527', assuming commit.

pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/local.txt
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/base.txt
  Requested meliae==0.4.0 (from -r requirements/edx/base.txt (line 47)), but installing version 0.4.0.final.0
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/post.txt
python manage.py cms --settings=devstack reindex_course --setup
2015-11-06 01:37:40,353 WARNING 4797 [xblock.plugin] plugin.py:147 - Unable to load XBlock 'html'
    Traceback...
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js'
2015-11-06 01:37:40,660 WARNING 4797 [xblock.plugin] plugin.py:147 - Unable to load XBlock 'course_info'
    Traceback...
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js'
    Traceback...
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js'
    Traceback ...
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js'
    Traceback ...
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js'

Build failed running pavelib.servers.devstack: Subprocess return code: 1

据我了解,这是 symlinks 的问题(请参阅 Google 组上的 this post)。

我 运行上面的 symlinks 脚本是否正确?如何检查 symlinks 是否已成功处理?

其他尝试:

根据google群里的建议(link上面),我也做了如下调整:

多次vagrant destroyvagrant provision之后,我仍然有同样的IOError: [Error 20] Not a directory问题。任何帮助将不胜感激!

版本:

我认为问题是你的cydrive路径不对造成的

尝试在c:\cygwin\etc\fstab

中改变

none /cydrive cygdrive binary,posix=0,user 0 0

none / cygdrive binary,posix=0,user 0 0

参考文献:https://cygwin.com/cygwin-ug-net/using.html#cygdrive

更新:

从 CMD 输入 'bash' 然后 copy/paste 脚本的内容

如果得到相同的结果,请尝试:

打开 .gitconfig(使用 Notepad++ 或类似工具)并添加此部分(如果尚不存在)

[alias]
add-symlink = "!__git_add_symlink(){\n    dst=$(echo \"\")/../$(echo \"\"); \n    if [ -e \"$dst\" ]; then \n        hash=$(echo -n \"\" | git hash-object -w --stdin); \n        git update-index --add --cacheinfo 120000 \"$hash\" \"\"; \n        git checkout -- \"\"; \n    else \n        echo \"ERROR: Target $dst does not exist!\"; \n        echo \"       Not creating invalid symlink.\"; \n    fi; \n    }; __git_add_symlink \"\" \"\""
rm-symlink = "!__git_rm_symlink(){\n    git checkout -- \"\"; link=$(echo \"\"); \n    POS=$'/'; DOS=$'\\\\'; \n    doslink=${link//$POS/$DOS}; \n    dest=$(dirname \"$link\")/$(cat \"$link\"); \n    dosdest=${dest//$POS/$DOS}; \n    if [ -f \"$dest\" ]; then \n        rm -f \"$link\"; \n        cmd //C mklink //H \"$doslink\" \"$dosdest\"; \n    elif [ -d \"$dest\" ]; then \n        rm -f \"$link\"; \n        cmd //C mklink //J \"$doslink\" \"$dosdest\"; \n    else \n        echo \"ERROR: Something went wrong when processing  . . .\"; \n        echo \"       $dest may not actually exist as a valid target.\"; \n    fi; \n    }; __git_rm_symlink \"\""
rm-symlinks = "!__git_rm_symlinks(){\n    for symlink in `git ls-files -s | grep -E \"^120000\" | cut -f2`; \n    do \n        git rm-symlink \"$symlink\"; \n        git update-index --assume-unchanged \"$symlink\"; \n    done; \n    }; __git_rm_symlinks"
checkout-symlinks = "!__git_checkout_symlinks(){\n    POS=$'/'; DOS=$'\\\\'; \n    for symlink in `git ls-files -s | grep -E \"^120000\" | cut -f2`; \n    do \n        git update-index --no-assume-unchanged \"$symlink\"; \n        if [ -d \"$symlink\" ]; then \n            dossymlink=${symlink//$POS/$DOS}; \n            cmd //C rmdir //S //Q \"$dossymlink\"; \n        fi; \n        git  checkout -- \"$symlink\"; \n        echo \"Restored git symlink $symlink <<===>> `cat $symlink`\"; \n    done; \n    }; __git_checkout_symlinks"

这将为符号链接创建一些 git 命令

注意:文件使用Unix行尾,请勿使用windows记事本编辑!

然后执行命令

git rm --cached -r .
git reset --hard
git rm-symlinks

我在我的环境中测试了它并且它有效