安装了 Ruby on Rails,但是当我尝试运行 Rails Sever 时它没有加载 WEBrick?
我今天在我的 mac 上安装了 Ruby on Rails 以及 Gems 和 MYsql。我正在尝试遵循 lynda.com 教程,但遇到了困难。当我尝试运行 Rails 服务器时,由于某种原因它没有加载 WEBrick。这是我得到的错误:
/Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require' from /Users/nutanpatel/Sites/simple_cms/config/application.rb:7 from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require' from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28 from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap' from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27 from script/rails:6:in `require' from script/rails:6
关于我能做什么的任何想法?请帮忙 - 我被困住了!
我做了rails -v,我使用的是3.0.5:
rails -v /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 Rails 3.0.5
顺便说一句:我尝试去做这个 sudo chmod go-w /usr/local/bin
但这没有解决任何问题。 我这样做的原因是: 警告:路径中的不安全世界可写目录 /usr/local/bin ,模式040777
I installed Ruby on Rails on my mac today along with Gems and MYsql. I'm trying to follow the lynda.com tutorial and I've run into a brick wall. When I try to run the rails server it doesnt load WEBrick for some reason. This is the error I get:
/Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require' from /Users/nutanpatel/Sites/simple_cms/config/application.rb:7 from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require' from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28 from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap' from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27 from script/rails:6:in `require' from script/rails:6
Any ideas on what I could do? Please help - I'm stuck!
I did rails -v and I'm on 3.0.5:
rails -v /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 Rails 3.0.5
BTW: I tried to go and do this sudo chmod go-w /usr/local/bin
but this did not resolve anything.
Reason I did this was because of: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我强烈建议您使用rvm安装ruby并重试:
OS X 附带的默认 ruby 存在许多问题。安装 RVM 时,您可以轻松获得 ruby 的全新安装。
请务必仔细阅读安装说明,尤其是关于在
.bashrc
中插入一行的最后一点。I strongly urge you to use rvm to install ruby and try again:
There are a number of issues with the default ruby that ships with OS X. When you install RVM, you can easily get a clean installation of ruby.
Make sure to read the install instructions carefully, especially the last bit about inserting a line into your
.bashrc
.此处回答了这个问题
This was answered here
忘记
warning: Insecure world writable dir
错误,这只是来自 Bundler 的警告,与阻止 Rails 启动的错误无关。该错误是由于 Mysql2 gem 未正确加载造成的。我也有同样的问题。基本上你需要 mysql 源文件才能正确编译 gem。我通过安装 Homebrew,然后用 Homebrew 安装 mysql,然后再次运行
Bundle install
解决了这个问题。试试这个:
brew install mysql
在终端中Gemfile.lock
文件,bundle exec Rails server
我知道我是这次聚会有点晚了,但我希望这对其他人有帮助。
Forget the
warning: Insecure world writable dir
error, that's just a warning from Bundler and has nothing to do with the error that is keeping Rails from starting.That error is due to the Mysql2 gem not loading properly. I had the same problem. Basically you need the mysql source files for the gem to compile properly. I solved it by installing Homebrew, then installing mysql with Homebrew, then running
Bundle install
again.Try this:
brew install mysql
in a terminalGemfile.lock
file inside your Rails appbundle exec rails server
I know I'm a little late to this party, but I'm hoping this might help someone else.
您必须设置
Gemfile
并运行bundle install
You have to set your
Gemfile
and runbundle install
您的 gems 目录似乎确实存在权限问题。尝试用以下方法解决这个问题:
You do seem to have permissions issues with your gems directory. Try resolving that with: