`bundle install` failed due to permission denied

醉酒当歌 提交于 2019-12-02 22:54:45

I found !

I had updated my rubygem like this gem update --system. But only my local gems were update due to the gem: --user-install restriction in my /etc/.gemrc. When bundler works, it use the global rubygem and not mine.

To fixe this issue, I updated the global rubygems with : sudo gem update --system --no-user-install.

And all works fine !

bundle install does not use the gemrc settings. (Although possibly that has changed in a recent update, but the update appears to load ~/.gemrc only, not /etc/gemrc)

You can do what you want with bundle install --path ~/.gem

However, I would highly recommend getting rbenv or RVM working. You said that you had the "same result" with rbenv. If your gems were trying to install into /var/lib/gems when you had rbenv installed, then it wasn't an rbenv-installed Ruby that was running that command. Either rbenv was still using the system Ruby (which it will until you pick an rbenv installed Ruby to become the default), or you did not have rbenv running correctly.

According to bundler documentation, a $BUNDLE_PATH or $GEM_HOME env variable can be set to make it the default writeable place.

export BUNDLE_PATH=~/.gems

bundle install

It is pretty handy if you {do not have/do not want to use} root access.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!