emacs - 将 emacs 苹果酒连接到 vagrant 宿主 clojure 项目

标签 emacs ssh clojure vagrant cider

我正在尝试使用 vagrant , Clojureemacs一起。具体来说,我无法连接cider到我的 vagrant机器。

它在本地工作,当我运行时 cider-jack-in在我的项目里面。
但我不知道在 vagrant 机器上的同一个项目(通过 vagrant 共享文件夹同步)中执行此操作的步骤是什么。

到目前为止,这是我的尝试:

  • ssh vagrant ,然后 cd my-project-dir ,然后 lein repl
  • 在 emacs 中,cider-connect , 输入 vagrant@192.168.50.50 , 端口 22

  • 我收到以下消息:

    SSH port forwarding failed. check the nrepl-tunnel buffer.



    在该缓冲区内:

    OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 Privileged ports can only be forwarded by root.

    Process nrepl-tunnel exited abnormally with code 255



    我如何以 root 身份运行它?这真的是问题吗?我应该使用另一个端口吗?我是否必须在我的 Clojure 代码中添加一些特定的内容才能启用它?给出的方向 here我有点不清楚。

    备注 : 它不同于 this question因为 emacs在主机上运行,​​而不是在 vagrant 上运行机器

    编辑 :

    以下是我所做的详细步骤,感谢@Shlomi 的回答:
  • 通过添加以下内容来编辑 .ssh/config(根据您编辑 IP Vagrantfile):

    宿主 Vagrant
    主机名 192.168.50.50
    端口 22
    用户 Vagrant
    ForwardAgent 是
  • 在主机中,使用 lein repl 启动我的项目.注意消息中的端口:nREPL server started on port 42018 on host 127.0.0.1 - nrepl://127.0.0.1:42018
  • 在 emacs 中,M-x cider-connect ,输入vagrant,你的密码和前面lein标注的端口命令。
  • 就是这样:)
  • 最佳答案

    您使用的端口似乎是 ssh 端口而不是 nrepl 端口。

    我通常使用emacs进行远程访问的方式是通过tramp:

  • Add an entry in .ssh/config对于您的远程主机,请说 vagrant
  • 在 emacs 中,cider-connect , 输入 vagrant
  • 在最新版本的 cider 中,它会自动查找该主机上所有事件的 nrepl session ,并显示它们的项目名称和端口,因此选择正确的一个,您应该可以开始工作。
  • 关于emacs - 将 emacs 苹果酒连接到 vagrant 宿主 clojure 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31538438/

    相关文章:

    emacs - 如何根据 GUI 使用情况设置 Emacs 设置?

    clojure - 尝试减少和减少 clojure 中的 IllegalArgumentException

    emacs - 如何默认启用 org-indent-mode?

    html - 在 Aquamacs 中默认禁用 html-helper-mode 以编辑 HTML

    c - 从 libssh2 获取 undefined reference

    php - Composer 更新内存限制

    java - 使用 JSch 时为 "Invalid privatekey"

    postgresql - clojure.java.jdbc 惰性查询

    clojure - clojure 中的未绑定(bind)函数 - 如何绑定(bind)它们?

    emacs - Orgmode : A report of tasks that are done within the week