Start webrick in port 80 (mysql2 gem issue)

前端 未结 2 722
日久生厌
日久生厌 2021-02-14 02:11

I am trying to get my webrick serve in port 80. I tried:

rails server -p 80

but get a access denied. I later understood that using port 1-1024

2条回答
  •  青春惊慌失措
    2021-02-14 02:43

    It seems that the mysql2 gem is not installed in the ruby run time that is used. however as this works for you without sudo, i suspect that you have rvm installed and you are using the rvm ruby (which has mysql installed) by default when lunching rails without sudo. but when you do sudo you are most probably using the system ruby which doesn't have mysql2 installed.

    so in short if you have rvm installed and is using that. just use:

    rvmsudo rails server -p 80
    

提交回复
热议问题