在 Ubuntu 14.04 LTS 上设置 rails 服务器 (4.2.4) 的问题

在 Ubuntu 14.04 LTS 上设置 rails 服务器 (4.2.4) 的问题

这是一个新手问题。我一直试图在我的 Ubuntu 14.04 LTS 上安装 Rails 4.2.4。我想我是使用 RVM 实现的,但我不确定是否安装了所有需要的东西,因为当我尝试使用命令:rails server(用于设置新应用程序)时,会出现以下消息:

    sara@sara:~/Escritorio/Rails/pinteresting$ rails server
Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
Ignoring nokogiri-1.6.6.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.6.2
bin/rails:6: warning: already initialized constant APP_PATH
/home/sara/Escritorio/Rails/pinteresting/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information

我不知道该怎么办。我在安装时忘记了一些东西?也许需要一个附加程序?

谢谢

答案1

我刚刚在我的 Ubuntu 14.04.3 机器上执行了此操作:

cd ~
rails new test-app
cd test-app
rails server

...然后它就启动了。所以在我看来,你的应用程序有问题。请尝试我的方法,看看效果如何。

此外,我在 Ubuntu 上遇到了很多麻烦rvm。因此,我使用rbenvhttps://github.com/sstephenson/rbenv)。

要安装rbenv,请执行以下操作:

# remove old rvm
sudo apt-get remove rbenv ruby-bundler ruby-rvm

# common rbenv and rails dependencies, generally good things to have
sudo apt-get install zlib1g-dev openssl libreadline-dev git-core libnotify-dev \
                     libc6-dev libssl-dev libmysql++-dev libsqlite3-dev \
                     make build-essential libssl-dev libreadline6-dev \
                     libyaml-dev curl

# rbenv installer
curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash

# Add rbenv init to .bashrc
echo 'export RBENV_ROOT="$HOME/.rbenv"' >> ~/.bashrc
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bashrc
exec $SHELL

# Install ruby (this takes many minutes ...~15-ish ...maybe 30 depending on your system)
rbenv install 2.2.2

# Defining which ruby version to use globally
rbenv global 2.2.2

此外,Ubuntu 上的 Rails 开发将得到 Prax 的帮助(https://github.com/ysbaddaden/prax),它与 ​​Pow 类似,但是适用于 Linux,并且用纯 Ruby 编写。

编辑:

我尝试过pinteresting应用程序,它对我来说也启动正常:

# I had to install a 2.0.0 version of Ruby 
rbenv install 2.0.0-p645

cd ~
git clone https://github.com/onemonthrails/pinteresting
cd pinteresting
echo '2.0.0-p645' > .ruby-version
bundle install
rake db:migrate
rails server

相关内容