安装了 Ruby on Rails,但是当我尝试运行 Rails Sever 时它没有加载 WEBrick?

发布于 2024-10-24 05:44:49 字数 2572 浏览 2 评论 0原文

我今天在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

噩梦成真你也成魔 2024-10-31 05:44:49

我强烈建议您使用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.

流心雨 2024-10-31 05:44:49

忘记 warning: Insecure world writable dir 错误,这只是来自 Bundler 的警告,与阻止 Rails 启动的错误无关。

该错误是由于 Mysql2 gem 未正确加载造成的。我也有同样的问题。基本上你需要 mysql 源文件才能正确编译 gem。我通过安装 Homebrew,然后用 Homebrew 安装 mysql,然后再次运行 Bundle install 解决了这个问题。

试试这个:

  1. 安装 Homebrew
  2. 使用 hombrew 安装 mysql: brew install mysql 在终端中
  3. 删除 Rails 应用程序中的 Gemfile.lock 文件,
  4. 再次运行“bundle install”,
  5. 尝试使用以下命令启动 Rails: 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:

  1. install Homebrew
  2. install mysql with hombrew: brew install mysql in a terminal
  3. delete the Gemfile.lock file inside your Rails app
  4. run 'bundle install` again
  5. try starting Rails with this command: bundle exec rails server

I know I'm a little late to this party, but I'm hoping this might help someone else.

往日 2024-10-31 05:44:49

您必须设置 Gemfile 并运行 bundle install

You have to set your Gemfile and run bundle install

短叹 2024-10-31 05:44:49

您的 gems 目录似乎确实存在权限问题。尝试用以下方法解决这个问题:

sudo find /Library/Ruby/Gems/1.8/gems/ -type d -exec chmod 755 '{}' +

You do seem to have permissions issues with your gems directory. Try resolving that with:

sudo find /Library/Ruby/Gems/1.8/gems/ -type d -exec chmod 755 '{}' +
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文