无法创建ROR项目

时间:2015-03-19 07:57:37

标签: ruby-on-rails ruby ruby-on-rails-3 gem rubygems

无法使用

创建Ruby on rails项目
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`

请让我知道这个问题的解决方案。

3 个答案:

答案 0 :(得分:0)

不要使用sudo。只有以下命令。

 rails new name_of_your_new_app

要运行此命令,您需要安装rails。要安装rails run

 gem install rails

答案 1 :(得分:0)

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

答案 2 :(得分:0)

我安装了RVM和RBENV。首先我卸载了两个。之后我按照命令

安装了ruby和rails
brew install ruby
gem install rails

现在工作正常。