无法创建 ROR 项目

Can't create ROR Project

无法使用

在 rails 项目上创建 Ruby
sudo rails new name_of_your_new_app

出现如下错误:

  run  bundle install

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
    Fetching gem metadata from https://rubygems.org/..........
    Resolving dependencies...
    Using rake 10.4.2
    Using i18n 0.7.0
    Using json 1.8.2
    Using minitest 5.5.1
    Using thread_safe 0.3.5
    Using tzinfo 1.2.2
    Using activesupport 4.2.0
    Using builder 3.2.2
    Using erubis 2.7.0
    Using mini_portile 0.6.2
    Using nokogiri 1.6.6.2
    Using rails-deprecated_sanitizer 1.0.3
    Using rails-dom-testing 1.0.6
    Using loofah 2.0.1
    Using rails-html-sanitizer 1.0.2
    Using actionview 4.2.0
    Using rack 1.6.0
    Using rack-test 0.6.3
    Using actionpack 4.2.0
    Using globalid 0.3.3
    Using activejob 4.2.0
    Using mime-types 2.4.3
    Using mail 2.6.3
    Using actionmailer 4.2.0
    Using activemodel 4.2.0
    Using arel 6.0.0
    Using activerecord 4.2.0
    Using debug_inspector 0.0.2
    Using binding_of_caller 0.7.2
    Using bundler 1.6.2
    Using columnize 0.9.0

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

        /Users/bhavesh/.rbenv/versions/rbx-2.2.10/bin/rbx extconf.rb 
    creating Makefile

    make "DESTDIR=" clean

    make "DESTDIR="
    compiling breakpoint.c
    In file included from breakpoint.c:1:
    ./byebug.h:5:10: fatal error: 'ruby/debug.h' file not found
    "#include <ruby/debug.h>"

    1 error generated.
    make: *** [breakpoint.o] Error 1

    make failed, exit code 2

Gem files will remain installed in /Users/bhavesh/.rbenv/versions/rbx-2.2.10/gems/gems/byebug-4.0.2 for inspection.Results logged to /Users/bhavesh/.rbenv/versions/rbx-2.2.10/gems/extensions/x86_64-darwin-13/2.1/byebug-4.0.2/gem_make.out
An error occurred while installing byebug (4.0.2), and Bundler cannot continue.

Make sure that `gem install byebug -v '4.0.2'` succeeds before bundling.
         run  bundle exec spring binstub --all
    bundler: command not found: spring
    Install missing gem executables with `bundle install`

请告诉我这个问题的解决方案。

不要使用 sudo。仅遵循命令。

 rails new name_of_your_new_app

要运行这个命令,需要安装rails。安装 rails 运行

 gem install rails

使用 gem install byebug -v '4.0.2' 在您的终端上安装 byebug,然后再次 运行 捆绑安装。确保它首先成功完成。如果您想要一个新的 rails 应用程序,只需输入 rails new name-of-your-app 即可。无需使用 sudo。

我安装了 RVM 和 RBENV。首先我卸载了两者。之后我按照下面的命令安装了 ruby 和 rails

brew install ruby
gem install rails

现在工作正常。