新手问题 bundle install 的问题

yirolhao · 2016年12月10日 · 最后由 yirolhao 回复于 2016年12月11日 · 3592 次阅读

今天 rails new xxx 的时候,bundle install 等了很久都不行,我就结束了,修改了 Gemfile,中的 source 为 ruby-china。 就出现了一个问题。

There was an error while trying to write to /home/yirolhao/.bundle/cache/compact_index/ruby.taobao.org.443.07113fbafd9bf5f337f3f6cee4b3a723. It is likely that you need to grant write permissions for that path.

之后将 source 换回来,还是有问题。

Unfortunately, an unexpected error occurred, and Bundler cannot continue. First, try this link to see if there are any existing issue reports for this error: https://github.com/bundler/bundler/search?q=Permission+denied+%40+dir_s_mkdir+-+%2Fhome%2Fyirolhao%2F.bundle%2Fcache%2Fcompact_index%2Frubygems.org.443.29b0360b937aa4d161703e6160654e47%2Fversions20161210-16855-1ckp38g&type=Issues If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at: https://github.com/bundler/bundler/issues/new

这该怎么解决啊?

权限问题,不过一般 bundle install 不用 sudo 吧,是不是 安装 bundler 的时候用了 sudo

感觉上,好多时候不明就里的用 sudo,会带来一连串的麻烦

删除 /home/yirolhao/.bundle/cache 然后重试

#1 楼 @springwq 忘记了,但是以前就没有出问题,突然冒出来的。

$ bundle show
$ bundle install

依次执行,不知道为啥就可以了。

#3 楼 @huacnlee 在 rails new xxx 的时候可以,但是有点慢,如果打断进入目录,运行 bundle,是第一个错误。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号