Installing Jekyll without root

2019-04-29 10:58发布

I want to set up a jekyll blog on a shared server. When I try to install Jekyll I get "You don't have write permissions". How do I fix this without root or sudo?

More detail:

I have space on a shared server and don't have root access. I couldn't install Ruby, though the hosting company installed it upon my request.

When I try to install Jekyll I use

user@hosting.org [~]# gem install jekyll

and this is the response I get:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.

I have seen different suggestions for changing the GEMPATH which I have tried including

export GEM_PATH=/home/user/something

But even after doing so

gem env 

still results in

GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/user/.gem/ruby/1.8

Any tips? Is it possible to install jekyll without root or sudo priviliges or am I just making some rookie PATH error?

2条回答
成全新的幸福
2楼-- · 2019-04-29 11:33

The reason for that is the default Ruby that gets shipped with Mac (I am assuming this, but this is true for some distributions of Linux as well) installs gems to a user folder that needs permissions to modify the contents. This is not a Ruby error to be precise.

That said, since Ruby 1.8.7 is not supported any more, you'd be better off avoiding using it and using one of the alternative ruby version managing tools like chruby or rvm or rbenv. (I'd vote for chruby btw). The documentation is pretty dense for all those. The authors are quite helpful in resolving issues if you do end up having one or more.

查看更多
神经病院院长
3楼-- · 2019-04-29 11:39

I didn't find the answer for a while. on the #jekyll IRC a user pointed me at the Arch wiki and I discovered that the thing is to force the install as a single user:

gem install jekyll --user-install
查看更多
登录 后发表回答